Web services CXF Web服务客户端-调用Web服务时未收到任何数据
我已经创建了一个客户端,使用maven和CXF访问WS,遵循教程和。 我已经使用SoapUI对web服务进行了多次测试,并收到了结果。但是当我从我的客户机调用相同的web服务时,我总是得到一个空响应。在web服务端,我观察到响应是正确发送的,对于SoapUI和我的客户机应用程序都是这样。 这是在客户端控制台上打印的内容:Web services CXF Web服务客户端-调用Web服务时未收到任何数据,web-services,soap,cxf,Web Services,Soap,Cxf,我已经创建了一个客户端,使用maven和CXF访问WS,遵循教程和。 我已经使用SoapUI对web服务进行了多次测试,并收到了结果。但是当我从我的客户机调用相同的web服务时,我总是得到一个空响应。在web服务端,我观察到响应是正确发送的,对于SoapUI和我的客户机应用程序都是这样。 这是在客户端控制台上打印的内容: WS init successful. Service class instantiated. In servlet Calling service now Action is
WS init successful. Service class instantiated.
In servlet Calling service now
Action is -- JAX-WS RI 2.1.6 in JDK 6: Stub for http://172.18.40.131:8080/AccountWithCXF/services/AccountSearchActionPort
In servlet after Calling service. list is -> []
有人能帮我吗
以下是WSDL:
<?xml version='1.0' encoding='UTF-8'?><wsdl:definitions name="AccountSearchActionService" targetNamespace="http://webservice/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://webservice/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:types>
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://webservice/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<import namespace="http://webservice/" schemaLocation="http://172.18.40.131:8080/AccountWithCXF/services/AccountSearchActionPort?xsd=accountsearchaction_schema1.xsd"/>
</schema>
</wsdl:types>
<wsdl:message name="getAccountsResponse">
<wsdl:part element="tns:getAccountsResponse" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="getAccounts">
<wsdl:part element="tns:getAccounts" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="AccountSearchAction">
<wsdl:operation name="getAccounts">
<wsdl:input message="tns:getAccounts" name="getAccounts">
</wsdl:input>
<wsdl:output message="tns:getAccountsResponse" name="getAccountsResponse">
</wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="AccountSearchActionServiceSoapBinding" type="tns:AccountSearchAction">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="getAccounts">
<soap:operation soapAction="urn:GetAccounts" style="document"/>
<wsdl:input name="getAccounts">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="getAccountsResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="AccountSearchActionService">
<wsdl:port binding="tns:AccountSearchActionServiceSoapBinding" name="AccountSearchActionPort">
<soap:address location="http://172.18.40.131:8080/AccountWithCXF/services/AccountSearchActionPort"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
来自调用web服务的Servlet的代码段:
AccountSearchAction action = service.getAccountSearchActionPort();
System.out.println("Action is -- "+action);
List<Account> list = action.getAccounts(param);
System.out.println("In servlet after Calling service. list is -> "+list);
AccountSearchAction action=service.getAccountSearchActionPort();
System.out.println(“动作是--”+动作);
列表=action.getAccounts(参数);
System.out.println(“调用service.list后在servlet中为->”+list);
如果我使用SoapUI和搜索查询“express”调用此web服务,我得到的响应如下:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns2:getAccountsResponse xmlns:ns2="http://webservice/">
<ns2:return>
<accountId>3067822</accountId>
<accountName>FBB EXPRESS INC.</accountName>
</ns2:return>
</ns2:getAccountsResponse>
</soap:Body>
</soap:Envelope>
3067822
FBB快递公司。
调试此功能的最简单方法是捕获请求和响应XML
一种方法是发送日志拦截器
另一种方法是使用tcpmon捕获请求/响应和响应。tcpmon的工作方式类似于代理—将其设置为侦听某个端口,然后将其转发到原始服务主机:port。使客户端将请求发送到tcpmon端口。最简单的调试方法是捕获请求和响应XML 一种方法是发送日志拦截器
另一种方法是使用tcpmon捕获请求/响应和响应。tcpmon的工作方式类似于代理—将其设置为侦听某个端口,然后将其转发到原始服务主机:port。让客户端向tcpmon端口发送请求。感谢您的响应。我还用TCPMon检查了请求和响应,发现与SoapUI中的行为相同。看起来这是在CXF客户端中解组响应的问题。有没有办法拦截解组过程?服务器是如何实现的?这也是使用CXF实现的。web服务是运行在Tomcat7上的JAX-WS实现。早些时候,它是Tomcat上的一个CXF web服务,但这也不起作用。感谢您的回复。我还用TCPMon检查了请求和响应,发现与SoapUI中的行为相同。看起来这是在CXF客户端中解组响应的问题。有没有办法拦截解组过程?服务器是如何实现的?这也是使用CXF实现的。web服务是运行在Tomcat7上的JAX-WS实现。早些时候,它是Tomcat上的CXF web服务,但这也不起作用。
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns2:getAccountsResponse xmlns:ns2="http://webservice/">
<ns2:return>
<accountId>3067822</accountId>
<accountName>FBB EXPRESS INC.</accountName>
</ns2:return>
</ns2:getAccountsResponse>
</soap:Body>
</soap:Envelope>