Soapclient: How to Pass Multiple Elements with Same Name

SoapClient: how to pass multiple elements with same name?

Fixed it by extends SoapClient and overrides __doRequest() method where I modify request as descibed here: http://www.php.net/manual/en/soapclient.dorequest.php#57995

Looks terrible for me, but it works "right here, right now".

PHP SOAP: Passing the same parameters with the same name

You can try to put the items into an array.

Example:

$relationCreate->relationFieldValues = [];

// repeat this in a foreach loop:
$item = new stdClass();
$item->PvFieldValueData = new stdClass();
$item->PvFieldValueData->Id = $uuid;
$item->PvFieldValueData->Value = $name;

// Add item to values
$relationCreate->relationFieldValues[] = $item;

PHP SoapClient - Multiple attributes with the same key

The ContactProfileAttribute element is one level too deep. Try:

$params = array(
'WSContact' => array(
'EmailAddress' => $email,
'ListID' => $listId,
'ContactProfileAttribute' => $attrs
),
'ProfileUpdateType' => 'Overwrite',
'ExternalEventIDs' => "",
'OverrideUnsubscribe' => TRUE,
);

Send data to SOAP API involving repeated elements of same name

You are overriding the properties key:

$a = [
'properties' => [
'name' => 'invtype',
'value' => 'foo'
],
'properties' => [
'name' => 'item_number',
'value' => 'foo'
],
];

This will leave the last entry only.

Make the value of the properties key an array:

$a = [
'properties' => [
[
'name' => 'invtype',
'value' => 'foo'
],
[
'name' => 'item_number',
'value' => 'foo'
],
],
];


Related Topics



Leave a reply



Submit