DString
DString

Reputation: 21

Magento XMLRPC API Fails Using finset Operator

Magento version 1.4.1.1

I'm trying to retrieve a product list filtered for a specific website using the XMLRPC API (catalog_product.list method call). The server returns "unknown error". I can call this same method and filter by status, sku, etc. But anytime I try to filter on a field that can contain multiple values (e.g. websites, categories, category_ids), I get the unknown error.

I'm using C# and Charles Cook's excellent xmlrpc.net library. I've captured the XML being sent to the server as shown below. Can anyone provide any insight into why this is happening?

This works:

<?xml version="1.0"?>
<methodCall>
  <methodName>call</methodName>
  <params>
    <param>
      <value>
        <string>81a7c4fffec8e78a6fe4b3f15f3e5cd0</string>
      </value>
    </param>
    <param>
      <value>
        <string>catalog_product.list</string>
      </value>
    </param>
    <param>
      <value>
        <array>
          <data>
            <value>
              <struct>
                <member>
                  <name>status</name>
                  <value>
                    <struct>
                      <member>
                        <name>eq</name>
                        <value>
                          <string>1</string>
                        </value>
                      </member>
                    </struct>
                  </value>
                </member>
              </struct>
            </value>
          </data>
        </array>
      </value>
    </param>
  </params>
</methodCall>

This doesn't:

<?xml version="1.0"?>
<methodCall>
  <methodName>call</methodName>
  <params>
    <param>
      <value>
        <string>5d7412249845e29458b63e3b03935445</string>
      </value>
    </param>
    <param>
      <value>
        <string>catalog_product.list</string>
      </value>
    </param>
    <param>
      <value>
        <array>
          <data>
            <value>
              <struct>
                <member>
                  <name>websites</name>
                  <value>
                    <struct>
                      <member>
                        <name>finset</name>
                        <value>
                          <string>1</string>
                        </value>
                      </member>
                    </struct>
                  </value>
                </member>
              </struct>
            </value>
          </data>
        </array>
      </value>
    </param>
  </params>
</methodCall>

Upvotes: 2

Views: 1142

Answers (2)

B00MER
B00MER

Reputation: 5491

You may want to give this a try, it may offer more examples as a guide to your problem: http://code.google.com/p/csharlibformagexmlrpcapi/

Upvotes: 0

Jonathan Day
Jonathan Day

Reputation: 18702

Can you use xdebug and your IDE to step through the request and track down which class is handling it? You may be able to read the source to track down if the multiple condition operators require a particular syntax.

EDIT

I recall that XSLT will not create an array if there is a single node instead of multiple siblings. So, if finset or other multiple condition operators are expecting an array, and you are passing a single node under <value>, it's possible that is being received as a scalar and hence the function call is failing? Perhaps try sending <value><string>1</string><string>2</string></value> to test my theory?

Upvotes: 0

Related Questions