Passing array of objects in SOAP

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • systemutvecklare@gmail.com

    Passing array of objects in SOAP

    Hi

    I can't find out how to send an array of objects with the built in SOAP
    in PHP5.

    My code looks like this:
    ****BEGIN CODE****
    $id = new GuidVO();
    $ids = array($id);
    $soap_param = new SoapParam($ids, 'AccountIds');
    $soap_params[] = $soap_param;
    $server->__soapCall($fu nction, $soap_params, null, $header,
    $output_headers );
    *****END CODE*****

    Part of the soap message produced by the code:
    ****BEGIN MESSAGE****
    <SOAP-ENV:Body>
    <ns1:getAccount s>
    <in0 SOAP-ENC:arrayType=" SOAP-ENC:Struct[1]"
    xsi:type="SOAP-ENC:Array">
    <item xsi:type="SOAP-ENC:Struct">
    <value
    xsi:type="xsd:s tring">749C8C07-FB54-4ED0-8F8F-0D49D2A359D8</value>
    </item>
    </in0>
    </ns1:getAccounts >
    </SOAP-ENV:Body>
    *****END MESSAGE*****

    The problem is that the arrayType is set to Struct. I want it to be set
    to GuidVO. I tried to use SoapVar in order to set the arrayType but
    apache crashes as a result of a php crash and I can't se the soap
    message that would have been sent to the server

    ****BEGIN CODE****
    $id = new GuidVO();
    $ids = array($id);
    $soapvar = new SoapVar($ids, SOAP_ENC_ARRAY, "GuidVO");
    $soap_param = new SoapParam($soap var, 'AccountIds');
    $soap_params[] = $soap_param;
    $server->__soapCall($fu nction, $soap_params, null, $header,
    $output_headers );
    *****END CODE*****

    Thanks for any suggestions about sending an array of objects in Soap!

    /Andreas

Working...