|
Hi all,
I am using Axis Java to connect to magento web services. Login is successful (and that known session issue is also fixed).
But I find it difficult to create the expected SOAP request for ‘customer.create’ operation.
<args SOAP-ENC:arrayType="ns2:Map[1]" xsi:type="SOAP-ENC:Array">
The parameter named “args” should be an Array of Maps. (as I understood, correct me if I’m wrong). So I created a request as follows.
<?xml version="1.0" encoding="UTF-8"?> <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> <ns1:call soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="urn:Magento"> <sessionId xsi:type="xsd:string">1vp029hcubiiven8cr1s21nke2</sessionId> <resourcePath xsi:type="xsd:string">customer.create</resourcePath> <args soapenc:arrayType="xsd:anyType[1]" xsi:type="soapenc:Array" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"> <args href="#id0"/> </args> </ns1:call> <multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns2:Map" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="http://xml.apache.org/xml-soap"> <item> <key xsi:type="soapenc:string">email</key> <value xsi:type="soapenc:string">myemail13@domain.com</value> </item> <item> <key xsi:type="soapenc:string">lastname</key> <value xsi:type="soapenc:string">myLastName</value> </item> <item> <key xsi:type="soapenc:string">firstname</key> <value xsi:type="soapenc:string">MyFirstName</value> </item> </multiRef> </soapenv:Body> </soapenv:Envelope>
But if I set an array of java.util.Map as above, it results in an error message saying;
“SOAP-ERROR: Encoding: Can’t decode apache map, only Strings or Longs are allowd as keys”.
What is the correct way to set this parameter in the request SOAP with Axis? Any help is appreciated. (I have shown the correct SOAP created from php at the end).
Thanks.
-----------------------------------------------------------------------------------------------
SOAP request message created from a php SOAPClient is as follows.
<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:Magento" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns2="http://xml.apache.org/xml-soap" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Body> <ns1:call> <sessionId xsi:type="xsd:string">mj3kj5rr2df0b1fq5kmputmr54</sessionId> <resourcePath xsi:type="xsd:string">customer.create</resourcePath> <args SOAP-ENC:arrayType="ns2:Map[1]" xsi:type="SOAP-ENC:Array"> <item xsi:type="ns2:Map"> <item> <key xsi:type="xsd:string">firstname</key> <value xsi:type="xsd:string">myFirstName</value> </item> <item> <key xsi:type="xsd:string">lastname</key> <value xsi:type="xsd:string">myLastName</value> </item> <item> <key xsi:type="xsd:string">email</key> <value xsi:type="xsd:string">myemail@mydomain.com</value> </item> </item> </args> </ns1:call> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
|