Jump to content

simplexml_load_string Problem


Go to solution Solved by requinix,

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

  • Solution

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;
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.