我是网络服务的新手。我遇到了一些问题。在服务器端,我使用的是 spring-ws。在客户端,我使用的是 jax-ws。使用 wsimport 工具,我根据我的 wsdl 生成了 java 类。
一切正常,但由于某种原因 jax-ws 无法正确解析数组和列表,所有列表都是空的
我绝对确定,该响应是正确的,用soapui对其进行了测试,而且我正在使用日志拦截器来记录输出响应。
以下是回复片段
反应看起来像
<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的片段
<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());
谢谢你。任何帮助将不胜感激。