0

I am creating a stdobject that is sent to to a wsdl wevservice via SOAP with a _soapcall.

It works when I send only one parameter but, sometimes i need to send 2 parameters under the same tag and I dont know hot to make it. Let me explain a little.

I create 2 std objects:

Object 1

$sObject4->PropertyToSearchName = 'State';
$sObject4->SearchComparer = 'Equals';
$sObject4->Value = new SoapVar(2, XSD_INT, 'int','http://www.w3.org/2001/XMLSchema');
$sObject3->SearchObject = $sObject4;

Object 2

$sObject41->PropertyToSearchName = 'ProviderId';
$sObject41->SearchComparer = 'Equals';
$sObject41->Value = new SoapVar(21, XSD_INT, 'int','http://www.w3.org/2001/XMLSchema');
$sObject31->SearchObject = $sObject41;

So i need to merge this 2 objects so i end up having something like:

[ListOfSearchObjects] => stdClass Object
  (
   [SearchObject] => stdClass Object
    (
    [PropertyToSearchName] => State
    [SearchComparer] => Equals
    [Value] => SoapVar Object
      (
      [enc_type] => 135
      [enc_value] => 2
      [enc_stype] => int
      [enc_ns] => http://www.w3.org/2001/XMLSchema
      )
    )
   [SearchObject] => stdClass Object
    (
    [PropertyToSearchName] => ProviderId
    [SearchComparer] => Equals
    [Value] => SoapVar Object
      (
      [enc_type] => 135
      [enc_value] => 21
      [enc_stype] => int
      [enc_ns] => http://www.w3.org/2001/XMLSchema
      )
    )
)

The created soap need to look like this with 2 [SearchObject]:

<ns3:ListOfSearchObjects>
<ns3:SearchObject>
<ns3:PropertyToSearchName>State</ns3:PropertyToSearchName>
<ns3:SearchComparer>Equals</ns3:SearchComparer>
<ns3:Value xsi:type="xsd:int">2</ns3:Value>
</ns3:SearchObject>
<ns3:SearchObject>
<ns3:PropertyToSearchName>Providerid</ns3:PropertyToSearchName>
<ns3:SearchComparer>Equals</ns3:SearchComparer>
<ns3:Value xsi:type="xsd:int">21</ns3:Value>
</ns3:SearchObject>
</ns3:ListOfSearchObjects>
1
  • 1
    Do you have any WSDL ? Commented Sep 30, 2013 at 12:11

1 Answer 1

1

If your method defined in the wsdl allows you to send multiple SearchObjects it should do the work for you when you pass it two:

$args = array( $SearchObj1, $SearchObj2 )

$res = $client->__soapCall( 'ListOfSearchObjects', $args );
Sign up to request clarification or add additional context in comments.

1 Comment

yes, it allows to send muktiple objects. Indeed I am already sending many. The only problem is sending 2 with the same name.... there it does format correctly.

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.