JAX-WS返回空列表 [英] JAX-WS return empty lists
问题描述
我是网络服务的新手。我遇到了一些问题。
在服务器端我正在使用spring-ws。在客户端我使用jax-ws。
使用wsimport工具我根据我的wsdl生成了java类。
I'm new in web services. I have faced some problem. At the server side i'm using spring-ws. At the client side i'm using jax-ws. With wsimport tool i have generated java classes according to my wsdl.
一切正常,但由于某种原因jax-ws不解析数组并正确列出,所有列表都是空的
Everything works fine, but for some reason jax-ws does not parse arrays and list correctly, all lists are empty
我绝对肯定,响应是正确的形式,用soapui测试它,我也使用日志拦截器来记录outcomming响应。
I'm absolutely sure, that response is form correctly, tested it with soapui, also i'm using logging interceptor to log outcomming responses.
以下是回复的片段
回复看起来像
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<firstElementResponse>
<name>hello world text</name>
<name>hello world text</name>
<name>hello world text</name>
</firstElementResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
以及wsdl
$ b的片段
and the snippets of wsdl
<xs:complexType name="sayHelloResponseType">
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" name="name" type="xs:string"/>
</xs:sequence>
</xs:complexType>
要生成客户端代码,请使用wsimport。
To generate client code i use wsimport.
SayHelloResponseType resp = serv.sayHello(r);
List<String> name = resp.getName();
System.out.println(name.size());
谢谢。任何帮助都将受到高度赞赏。
Thank you. Any help will be highly appreciated.
推荐答案
似乎它只是一个无效的响应体,不是数学wsdl shema。两个春天都没有jax-ws抛出异常。它只是将无效数据解析为空列表而没有任何更改。
Seems it's just an invalid body of response, that does not math wsdl shema. Neither spring-ws neither jax-ws throws exception. It simply parse invalid data to empty list without any warrnings.
org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor
保存了我的一天
可能我必须调整jax-ws的日志记录以避免下次
probably i have to tweak logging for jax-ws to avoid it next time
这篇关于JAX-WS返回空列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!