【发布时间】:2010-08-30 14:11:12
【问题描述】:
我是网络服务的新手。我遇到了一些问题。 在服务器端,我使用的是 spring-ws。在客户端,我使用的是 jax-ws。 使用 wsimport 工具,我根据我的 wsdl 生成了 java 类。
一切正常,但由于某种原因,jax-ws 无法正确解析数组和列表,所有列表都是空的
我绝对确定,响应格式正确,用soapui测试过,我也在使用日志拦截器来记录输出响应。
下面是响应的sn-ps
响应看起来像
<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的sn-ps
<xs:complexType name="sayHelloResponseType">
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" name="name" type="xs:string"/>
</xs:sequence>
</xs:complexType>
为了生成客户端代码,我使用 wsimport。
SayHelloResponseType resp = serv.sayHello(r);
List<String> name = resp.getName();
System.out.println(name.size());
谢谢。任何帮助将不胜感激。
【问题讨论】:
标签: java soap jax-ws spring-ws