做了一个webservice接口,在测试接口调用的一直调用不到。
WSDL
<?xml version="1.0" encoding="UTF-8"?>
-<wsdl:definitions targetNamespace="http://impl.webservice.topflames.com/" name="oaSendDocumentWebService"
xmlns:ns1="http://topflames.com/webservices/" xmlns:ns2="http://schemas.xmlsoap.org/soap/http"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://impl.webservice.topflames.com/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:import namespace="http://topflames.com/webservices/" location="http://192.168.0.104:8080/topflames-jmoaxt/webservice/oaSendDocumentWebService?wsdl=OaSendDocumentWebService.wsdl"> </wsdl:import>
-<wsdl:binding name="oaSendDocumentWebServiceSoapBinding" type="ns1:OaSendDocumentWebService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
-<wsdl:operation name="saveDocumentSend">
<soap:operation style="document" soapAction=""/>
-<wsdl:input name="saveDocumentSend">
<soap:body use="literal"/>
</wsdl:input>
-<wsdl:output name="saveDocumentSendResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
-<wsdl:service name="oaSendDocumentWebService">
-<wsdl:port name="OaSendDocumentWebServiceImplPort" binding="tns:oaSendDocumentWebServiceSoapBinding">
<soap:address location="http://192.168.0.104:8080/topflames-jmoaxt/webservice/oaSendDocumentWebService"/> </wsdl:port>
</wsdl:service>
</wsdl:definitions>
调用代码
String endpoint = "http://192.168.0.104:8080/topflames-jmoaxt/webservice/oaSendDocumentWebService?wsdl";
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(endpoint);
//http://webService.service.oais.flyingsoft.cn
call.setOperationName(new QName("http://topflames.com/webservices","saveDocumentSend"));// WSDL里面描述的接口名称
call.addParameter("object", XMLType.XSD_STRING, ParameterMode.IN);// 接口的参数
call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);// 设置返回类型
String result = (String) call.invoke(new Object[] { xml });
System.out.println("result is " + result);
报错信息:
org.apache.cxf.interceptor.Fault: Unexpected wrapper element {http://topflames.com/webservices}saveDocumentSend found. Expected {http://topflames.com/webservices/}saveDocumentSend.
at org.apache.cxf.wsdl.interceptors.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:106) ~[cxf-rt-wsdl-3.0.4.jar:3.0.4]
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307) ~[cxf-core-3.0.4.jar:3.0.4]
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) [cxf-core-3.0.4.jar:3.0.4]
at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:251) [cxf-rt-transports-http-3.0.4.jar:3.0.4]
at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234) [cxf-rt-transports-http-3.0.4.jar:3.0.4]
at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208) [cxf-rt-transports-http-3.0.4.jar:3.0.4]
at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160) [cxf-rt-transports-http-3.0.4.jar:3.0.4]
at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:171) [cxf-rt-transports-http-3.0.4.jar:3.0.4]
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:293) [cxf-rt-transports-http-3.0.4.jar:3.0.4]
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:212) [cxf-rt-transports-http-3.0.4.jar:3.0.4]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:650) [servlet-api.jar:na]
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:268) [cxf-rt-transports-http-3.0.4.jar:3.0.4]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) [catalina.jar:7.0.69]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) [catalina.jar:7.0.69]
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) [tomcat7-websocket.jar:7.0.69]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) [catalina.jar:7.0.69]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) [catalina.jar:7.0.69]
at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61) [shiro-web-1.2.3.jar:1.2.3]
at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108) [shiro-web-1.2.3.jar:1.2.3]
at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137) [shiro-web-1.2.3.jar:1.2.3]
at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) [shiro-web-1.2.3.jar:1.2.3]
at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66) [shiro-web-1.2.3.jar:1.2.3]
at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449) [shiro-web-1.2.3.jar:1.2.3]
at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365) [shiro-web-1.2.3.jar:1.2.3]
看报错信息好像是没找到方法。但是调用的接口地址,方法名字都没错啊。
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。