我在http协议请求消息上构建了一个soap,如下所示:
<HttpClientRq>
<header>
<parameter name="Content-Type" value="text/xml"/>
</header>
<body>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sam="http://www.soapui.org/sample/">
<soapenv:Header/>
<soapenv:Body>
<sam:login>
<username>Login</username>
<password>Login123</password>
</sam:login>
</soapenv:Body>
</soapenv:Envelope>
</body>
</HttpClientRq>
我使用SOAPUI工具创建一个模拟服务操作,登录。
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sam="http://www.soapui.org/sample/">
<soapenv:Header/>
<soapenv:Body>
<sam:login>
<username>Login</username>
<password>Login123</password>
</sam:login>
</soapenv:Body>
</soapenv:Envelope>
我发送上面的请求消息,SOAPUI设法成功接收请求消息。但不幸的是,它遇到如下错误:
ERROR [SoapUI] An error occurred [org.apache.xmlbeans.XmlException: Missing/Invalid SOAP Envelope, expecting [{http://schemas.xmlsoap.org/soap/envelope/}Envelope]], see error log for details
2016-07-26 17:31:57,943 ERROR [errorlog] com.eviware.soapui.impl.wsdl.mock.DispatchException: org.apache.xmlbeans.XmlException: Missing/Invalid SOAP Envelope, expecting [{http://schemas.xmlsoap.org/soap/envelope/}Envelope]
com.eviware.soapui.impl.wsdl.mock.DispatchException: org.apache.xmlbeans.XmlException: Missing/Invalid SOAP Envelope, expecting [{http://schemas.xmlsoap.org/soap/envelope/}Envelope]
at com.eviware.soapui.impl.wsdl.mock.WsdlMockDispatcher.dispatchPostRequest(WsdlMockDispatcher.java:241)
at com.eviware.soapui.impl.wsdl.mock.WsdlMockDispatcher.dispatchRequest(WsdlMockDispatcher.java:113)
at com.eviware.soapui.impl.wsdl.mock.WsdlMockRunner.dispatchRequest(WsdlMockRunner.java:142)
at com.eviware.soapui.monitor.JettyMockEngine$ServerHandler.handle(JettyMockEngine.java:604)
at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.xmlbeans.XmlException: Missing/Invalid SOAP Envelope, expecting [{http://schemas.xmlsoap.org/soap/envelope/}Envelope]
at com.eviware.soapui.impl.wsdl.support.soap.SoapUtils.getBodyElement(SoapUtils.java:134)
at com.eviware.soapui.impl.wsdl.support.soap.SoapUtils.getContentElement(SoapUtils.java:172)
at com.eviware.soapui.impl.wsdl.support.soap.SoapUtils.findOperationForRequest(SoapUtils.java:200)
at com.eviware.soapui.impl.wsdl.mock.WsdlMockDispatcher.dispatchPostRequest(WsdlMockDispatcher.java:191)
... 15 more
我不明白。错误日志抱怨无效/丢失soap:信封虽然我已包含在我的请求消息中。 我希望有人能给我建议和指导,非常感谢。