现有的 WebService(用 PHP 编写)将 Key、Value Store 指定为xsd:struct
. 因为 Axis 不知道如何解释这一点,所以我喜欢下载并修补 Wsdl 以供我个人使用。
最后,生成的请求应如下所示:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:emn="interface.foobar">
<soap:Header/>
<soap:Body>
<emn:searchFoobar>
<emn:searchParameter>
<emn:username>xxxx</emn:username>
<emn:password>xxxx</emn:password>
<emn:maxHitCount>1</emn:maxHitCount>
<emn:sorting>distance</emn:sorting>
<emn:searchtext>example</emn:searchtext>
</emn:searchParameter>
</emn:searchFoobar>
</soap:Body>
</soap:Envelope>
在此示例中,它在我的客户端上searchParameter
用作。java.util.HashMap
它的子项是 Key 和 Value 条目。
就像这样:
<emn:hashmapName>
<key1>value1</key1>
<key2>value2</key2>
<key3>value3</key3>
</emn:hashmapName>
完整的 WSDL 如下所示(最后我喜欢用 替换xsd:struct
)java.util.HashMap
:
<?xml version="1.0"?>
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://foobar.service.de/service/v2" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" name="Soap_Manager" targetNamespace="http://foobar.service.de/service/v2">
<types>
<xsd:schema targetNamespace="http://foobar.service.de/service/v2"/>
</types>
<portType name="Soap_ManagerPort">
<operation name="searchFoo">
<documentation>searchFoo</documentation>
<input message="tns:searchFooIn"/>
<output message="tns:searchFooOut"/>
</operation>
</portType>
<binding name="Soap_ManagerBinding" type="tns:Soap_ManagerPort">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="searchFoo">
<soap:operation soapAction="http://foobar.service.de/service/v2#searchFoo"/>
<input>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://foobar.service.de/service/v2"/>
</input>
<output>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://foobar.service.de/service/v2"/>
</output>
</operation>
</binding>
<service name="Soap_ManagerService">
<port name="Soap_ManagerPort" binding="tns:Soap_ManagerBinding">
<soap:address location="http://foobar.service.de/service/v2"/>
</port>
</service>
<message name="searchFooIn">
<part name="param" type="xsd:struct"/>
</message>
<message name="searchFooOut">
<part name="return" type="xsd:struct"/>
</message>
</definitions>
有人可以告诉我如何java.util.HashMap
为这种用途指定 a 吗?