我输入的命令:wsdl2java -d g:/ws -p com.etoak.client http://localhost:8080/Spring_Springmvc_Mybatis/ws/user?wsdl
但是总是遇到下面的异常:
WSDLToJava Error: org.apache.cxf.wsdl11.WSDLRuntimeException: Fail to create wsdl definition http://localhost:8080/Spring_Springmvc_Mybatis/ws/user?wdsl: WSDLException: faultCode=PARSER_ERROR: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog
at [row,col,system-id]: [1,0,“http://localhost:8080/Spring_Springmvc_Mybatis/ws/user?wdsl”]
找了一个多小时才找到问题所在,因为我也在网上百度了,但是没有找到答案,所以把我的解决方案分享给大家。
出现问题的原因:在我的工程中,设置了拦截器,因此把这个请求也拦截下来了。给大家看看我的拦截器:
uri.contains(“ws”)条件是后来加上的,之前没有这个条件,所以不行,加上以后就可以了。
总之,问题就在于拦截器,解决方法就是在拦截器中放行!