<分区>
我有一个带有 Axis 1 客户端的 Axis 1 Web 服务。一切都运行良好,我从网络服务获得的数据是正确的。现在,需要移动 Web 服务以使用 Axis 2,我在 Axis 1 客户端上获取数据时遇到问题。我已经使用 SOAPUI 来查看我收到的响应的格式。
对于 Axis 1 网络服务,响应如下:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<getInventoryResponse xmlns="http://webservices.com">
<getInventory>
<errorCode>10071</errorCode>
<inventory xsi:nil="true"/>
</getLastInventoryCountReturn>
</getInventoryResponse>
</soapenv:Body>
</soapenv:Envelope>
使用 Axis 2 网络服务,响应如下:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<ns:getInventoryResponse xmlns:ns="http://webservices.com">
<ns:return xsi:type="ax21:Inventory" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ax21="http://model.com/xsd">
<ax21:errorCode>10071</ax21:errorCode>
<ax21:inventory xsi:nil="true"/>
</ns:return>
</ns:getInventoryResponse>
</soapenv:Body>
</soapenv:Envelope>
如您所见,名为“errorCode”的元素的值为 10071。我在客户端从两个 Web 服务正确接收到 errorCode 值。但是我有一个称为“库存”的复杂类型,作为响应的一部分收到(它没有出现在我上面包含的响应中,因为我需要一些时间来填充 Web 服务上的适当数据)。 InventoryItem 包含不同数据类型(字符串、日历)的字段。我注意到 Axis 2 Web 服务的响应包含 <axs21>
xml 标记,而在 Axis 1 Web 服务中,它不存在。因此,我假设我在客户端遇到来自 Axis 2 Web 服务的响应的解析问题。
有谁知道我该如何解决这个问题?