Jump to content

simplexml_load_string Problem


mrmonteith

Recommended Posts

 I'm new to SOAP and WSDLs in general.  The stuff I'm debugging they said hasn't worked for quite some time.  So this makes it harder.  But basically I'm debugging the PHP script and got to this point:

 

I wrote the output of $order_request as follows:

<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><fireOrder xmlns="http://ws.configureone.com"><in0>10203</in0></fireOrder></soapenv:Body></soapenv:Envelope>

Then they try the following:

$xml = simplexml_load_string($order_request, NULL, NULL, "http://schemas.xmlsoap.org/soap/envelope/");

But it appears that $xml is empty.   From what I read it's supposed to convert a simple XML string into an object but don't think it will work in this situation.   Maybe I'm wrong.  Either way I'm not getting anything out of it.

 

Thanks.

Michael

Link to comment
https://forums.phpfreaks.com/topic/295516-simplexml_load_string-problem/
Share on other sites

SimpleXML is a bit picky about what it shows when you print_r() or var_dump() it. Namespaces can make it look like there's no data when there is.

 

Fact is that trying to get data out of it is the easiest way to see if it's working. Try

echo $in0 = $xml->Body->children("http://ws.configureone.com")->fireOrder->in0;
or if not that,

echo $in0 = $xml->children("http://schemas.xmlsoap.org/soap/envelope/")->Body->children("http://ws.configureone.com")->fireOrder->in0;

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.