Question

I need to pass multiple NameValueLists via SOAP, but I have no idea how to include their data.

This is how it should look like:

<Variations>
      <VariationSpecificsSet>
        <NameValueList>
          <Name>Size</Name>
          <Value>XL</Value>
        </NameValueList>
        <NameValueList>
          <Name>Color</Name>
          <Value>Black</Value>
        </NameValueList>
    </VariationSpecificsSet>
</Variations>

Part of my PHP code:

$params->Item->Variations = new ArrayObject();
$params->Item->Variations->VariationSpecificsSet = new ArrayObject();
$params->Item->Variations->VariationSpecificsSet->NameValueList = new ArrayObject();

$list = new ArrayObject();
$list->name = 'title';
$list->value = "value";
$arr[0] = $list;
$arr[1] = $list;

$params->Item->Variations->VariationSpecificsSet->NameValueList = $arr;
$ebay->ebayCall( "VerifyAddFixedPriceItem", $params );

Debug output of $params:

[Variations] => ArrayObject Object
    (
        [VariationSpecificsSet] => ArrayObject Object
            (
                [NameValueList] => Array
                    (
                        [0] => ArrayObject Object
                            (
                                [name] => title
                                [value] => value
                                [storage:ArrayObject:private] => Array
                                    (
                                    )

                            )

                        [1] => ArrayObject Object
                            (
                                [name] => title
                                [value] => value
                                [storage:ArrayObject:private] => Array
                                    (
                                    )

                            )

                        [2] => ArrayObject Object
                            (
                                [name] => title
                                [value] => value
                                [storage:ArrayObject:private] => Array
                                    (
                                    )

                            )

                    )

                [storage:ArrayObject:private] => Array
                    (
                    )

            )

        [storage:ArrayObject:private] => Array
            (
            )

    )

The resulting request: No names, neither values in the NameValueLists

<ns1:Variations>
    <ns1:VariationSpecificsSet>
        <ns1:NameValueList/>
        <ns1:NameValueList/>
        <ns1:NameValueList/>
    </ns1:VariationSpecificsSet>
</ns1:Variations>

How do I put the data correctly in the NameValueLists? The debug output seems good to me, but it wont show up in the XML. I can't be the first one..?

Edit: I found a question on SO that describes exactly my problem: Php soap client multiple node I tried this approach before asking here, but it still dont work for me. I'm guessing, it has something to do with the eBay wsdl, but I cant figure out what exactly

Was it helpful?

Solution

Missing capital Letters at $list->name and $list->value is the answer. hope that helps anyone else sometime. grrr

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top