我必須基於WSDL文件創建某個SOAP請求消息。我正在使用SOAP UI來從WSDL創建SOAP請求。爲特定的SOAP請求創建WSDL
的SOAP請求應該是這樣的:
<?xml version="1.0"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
SOAP-ENV:encodingstyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Header>
<username>xxxx</username>
<password>xxxx</password>
<MaxOrders>1</MaxOrders>
<xmlVers>1</xmlVers>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<m:getNewOrders xmlns:m= "urn:https://xxx.yyy.co.uk/b2b/soap/soap:getNewOrders/">
</m:getNewOrders>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
我有以下WSDL:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions
xmlns:m="https://xxx.yyy.co.uk/b2b/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
name="xxxOrders"
targetNamespace="https://xxx.yyy.co.uk/b2b/">
<wsdl:types>
<xsd:schema targetNamespace="https://xxx.yyy.co.uk/b2b/">
<xsd:element name="Envelope">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Header"/>
<xsd:element name="Body"/>
</xsd:sequence>
<xsd:attribute name="encodingstyle" type="xsd:anyURI" form="qualified" use="required" />
</xsd:complexType>
</xsd:element>
<xsd:element name="Header">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="username" type="xsd:NCName" form="unqualified" />
<xsd:element name="password" type="xsd:integer" form="unqualified" />
<xsd:element name="MaxOrders" type="xsd:integer" form="unqualified" />
<xsd:element name="xmlVers" type="xsd:integer" form="unqualified" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Body">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="m:getNewOrders" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="getNewOrders">
<xsd:complexType />
</xsd:element>
</xsd:schema>
</wsdl:types>
<wsdl:message name="getNewOrders">
<wsdl:part element="m:getNewOrders" name="parameters"/>
</wsdl:message>
<wsdl:portType name="xxxOrders">
<wsdl:operation name="getNewOrders">
<wsdl:input message="m:getNewOrders"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="xxxOrdersSOAP" type="m:xxxOrders">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="getNewOrders">
<soap:operation soapAction="urn:https://xxx.yyy.co.uk/b2b/soap/soap:getNewOrders/"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="xxxOrders">
<wsdl:port binding="m:xxxOrdersSOAP" name="xxxOrdersSOAP">
<soap:address location="https://xxx.yyy.co.uk/b2b/soap/soap_orders.asp"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
但是,當我採取WSDL和SOAP UI導入,SOAP請求消息看起來不同於我的預期:
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:b2b="https://xxx.yyy.co.uk/b2b/">
<soapenv:Header/>
<soapenv:Body>
<b2b:getNewOrders/>
</soapenv:Body>
</soapenv:Envelope>
我的Header
元素爲空f或例子。 getNewOrders
我認爲沒關係,因爲它綁定到xmlns:b2b
,所以我不需要元素getNewOrders中的名稱空間。我對麼?
請別人指出我必須在WSDL中修復哪些內容?我搞不清楚了。
「https:// b2bqa.shoprite.co.za/b2b /」的含義與「https:// xxx.yyy.co.uk/b2b /'相同嗎? –
@John:謝謝。是的,對不起 - 我編輯它。 – Peter