Jump to content

Extracting an array from an XML response


limessl

Recommended Posts

I'm having trouble with an API. I usually send the data to the API using

 

$client = new soapclient_gt($order_url, 'true');

$result = $client->call('QuickOrder',$params);

 

And from that I can simply use variables such as $result->field1 in order to read the response.

 

However from the code I've been given there appears to be a bug in nusoap which means the particular example I'm working on simply fails (I have absolutely no idea what the bug is, but I've tried to call the API using the above format and it does indeed fail to even send the request properly).

 

So, in this example I'm having to build the whole XML file as a variable and send it using

 

$client->send($xml);

 

The problem is that I have no idea how to extract the array from $client->response.

 

If I use print_r($client->response) and then look at the page source, it shows me this :-

I need to create a variable called $success which looks at the value of SuccessCode, in the above example this would be 0.

 

I have run out of google searches so I'm going to pass it onto the experts :)

OK I now have a new version of nusoap, sadly all the functions and syntax is different and the furthest I can get is an error saying :-

 

Array

(

    [faultcode] => env:Server

    [faultstring] => Failed to invoke end component webservice.Order (POJO), operation=ValidateOrderParameters

-> Failed to invoke method

 

    [detail] => Array

        (

            [string] => java.lang.NullPointerException

 

        )

 

)

 

I'm afraid this is all far too complex for me :(

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.