I'm using XMLTools.loadWSDL to access an existing web service. The "findAllForNameContains" operation has an input message where the first part is named "environment" which is a complex type "ipmsEnvironment" consisting of two elements; environmentName and userId. Here are the relevant parts of the wsdl.
The problem is that the SOAP request envelope looks like this.
The <ipmsEnvironment> element should be called <environment>; the name of the part, not the name of it's type. When I attempt to call the service, the server returns the following error.
A call to the service with the same SOAP envelope, but with the "ipmsEnvironment" element changed to the correct name of "environment" works fine. This happens when I use the WSDL tab in the developer's console to access the service, so I'm sure it isn't anything I'm doing wrong in my code. ??
Code:
<xs:complexType name="ipmsEnvironment"> <xs:sequence> <xs:element minOccurs="0" name="environmentName" type="xs:string" /> <xs:element minOccurs="0" name="userId" type="xs:string" /> </xs:sequence> </xs:complexType> </wsdl:operation> <wsdl:operation name="findAllForNameContains"> <wsdl:input message="tns:findAllForNameContains" name="findAllForNameContains"></wsdl:input> <wsdl:output message="tns:findAllForNameContainsResponse" name="findAllForNameContainsResponse"></wsdl:output> </wsdl:operation> <wsdl:message name="findAllForNameContains"> <wsdl:part name="environment" type="tns:ipmsEnvironment"></wsdl:part> <wsdl:part name="nameContains" type="xsd:string"></wsdl:part> </wsdl:message>
Code:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soap:Header/> <soap:Body> <opNS:findAllForNameContains xmlns:opNS="http://services.merchandise.ipms.islandpacific.com/"> <ipmsEnvironment> <environmentName>IPTSFILX</environmentName> <userId>JFISHER</userId> </ipmsEnvironment> <nameContains>A</nameContains> </opNS:findAllForNameContains> </soap:Body> </soap:Envelope>
Code:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <soap:Fault> <faultcode>soap:Server</faultcode> <faultstring>Found element ipmsEnvironment but could not find matching RPC/Literal part</faultstring> </soap:Fault> </soap:Body> </soap:Envelope>
Comment