Given the following PHP which returns a valid Soap/XML Response:
$params = new StdClass();
$params->subRequest = new StdClass();
$params->subRequest->endCSN = "0212341234";
$client = new SoapClient($WSDL);
$response = $client->qualifyProduct($params);
I'm trying to implement the connection to this web service in Python, but I'm not getting very far - running into errors (I tried in PHP just as a sanity check).
I've so far tried a number of possible options that seem to make sense in my head including:
client = SoapClient(WSDL)
a = type('lambdaobject', (object,), {})()
a.endCSN = "0212341234"
response = client.qualifyProduct(subRequest = a)`
response = client.qualifyProduct({'subRequest':{'endCSN':{'0212121212'}}})
response = client.qualifyProduct(subRequest = {'endCSN':{'0212121212'}})
None of which work - and all give me a PySimpleSoap error like:
ValueError: Invalid Args Structure. Errors: [u"Argument key subRequest not in parameter.
The answer for PySimpleSoap: How to pass a complexType as a function parameter seemed to offer a glimmer of hope, but didn't end up working in my instance.
I do have other functions working with the given WSDL, but none with a ComplexType for the method defined like this extract where the subRequest and anotherSubRequest types are defined in another .xsd file:
<xsd:complexType name="QualifyProductRequest">
<xsd:sequence>
<xsd:choice>
<xsd:element name="subRequest" type="wsg:subRequest">
<xsd:annotation>
<xsd:documentation xml:lang="en">A complex type capturing required data for a qualification</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="anotherSubRequest" type="wsg:anotherSubRequest">
<xsd:annotation>
<xsd:documentation xml:lang="en">A complex type capturing required data for a different qualification</xsd:documentation>
</xsd:annotation>
</xsd:element>
<! -- SNIPPED -->
</xsd:choice>
</xsd:sequence>
</xsd:complexType>