1

Before i ask the question, let me just put it this way that i have found couple of close answers to my question. But these answers are fit for the clients implemented in PHP on a server (things are a bit easier this way)

But I am using the latest set of SOAP API's to connect to Magento from an Android client written in Java. I have a set of requirements where i have to filter the products, orders by various parameters.

Unfortunately I am not able to set the filters correctly. Below is a snippet of the SOAP request I am making in one of the cases (the error response i have posted below it).

Please help me in configuring the correct filter.

<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:Magento" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
   <soapenv:Header/>
   <soapenv:Body>
      <urn:catalogProductList soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
         <sessionId xsi:type="xsd:string">d983bbee001cff69e25fdc75b5ad3394</sessionId>
         <filters xsi:type="urn:filters">
            <!--You may enter the following 2 items in any order-->
            <!--Optional:-->
            <filter xsi:type="urn:associativeArray" soapenc:arrayType="urn:associativeEntity[]">
                **<key xsi:type="xsd:string">product_id</key>
                <value xsi:type="xsd:string">2</value>**
        </filter>
            <!--Optional:-->
            <complex_filter xsi:type="urn:complexFilterArray" soapenc:arrayType="urn:complexFilter[]">
            </complex_filter>
         </filters>
         <storeView xsi:type="xsd:string">malaysian</storeView>
      </urn:catalogProductList>
   </soapenv:Body>
</soapenv:Envelope>

Response ---

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
   <SOAP-ENV:Body>
      <SOAP-ENV:Fault>
         <faultcode>SOAP-ENV:Server</faultcode>
         <faultstring>Call to a member function getAttributeCode() on a non-object</faultstring>
      </SOAP-ENV:Fault>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

1 Answer 1

1

Ah, you here pretty close.
The only think that is missing is a wrapper tag for your key-value pair.
The filter tag should look like this:

<filter xsi:type="urn:associativeArray" soapenc:arrayType="urn:associativeEntity[]">
     <item><!-- this is missing on your side -->
        <key xsi:type="xsd:string">product_id</key>
        <value xsi:type="xsd:string">2</value>
     </item>
</filter>
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.