943,696 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 2493
  • PHP RSS
Jan 8th, 2009
0

Issues with Soap/XML/Nusoap/Stripped Slashes

Expand Post »
Hey Guys,

I appreciate any and all help.

I'm trying to print out the results of a query I've made to another server using the nusoap client. I'm successfully sending my XML Array to their WSDL web service and they are sending an XML response back. <RESULTS><TEXT>Success</TEXT></RESULTS>

However all < and > symbols are missing. Quotes and every other symbol is intact.

I'm using the nusoap classes and functions, and I'm wondering if there is a parameter perhaps that I need to pass so that the data retains its XML structure or?


So when they send back their results it looks like this....

RESULTSTEXTSuccess/TEXT/RESULTS

The code I'm using to open the soapclient and gather the results its pretty simply. I'm not setting any paramters outside

PHP Syntax (Toggle Plain Text)
  1. $args = array ("xml"=>$str);
  2. $client = new soapclient($url,"wsdl"); $results = $client->call("User_Data", $args);


Thanks again.

Edit/Delete Message
Reputation Points: 10
Solved Threads: 0
Newbie Poster
coolguy20 is offline Offline
1 posts
since Jan 2009
Jan 9th, 2009
0

Re: Issues with Soap/XML/Nusoap/Stripped Slashes

Reputation Points: 33
Solved Threads: 9
Junior Poster
pclfw is offline Offline
132 posts
since Jun 2005
Jan 11th, 2010
0
Re: Issues with Soap/XML/Nusoap/Stripped Slashes
Coolguy20,

Did you ever get this figured out? The string can't be parsed as xml because the < and > characters are missing. I am having the same issue and trying to solve this as well.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
mitcrellim is offline Offline
2 posts
since Jan 2010
Jan 22nd, 2010
1

How I fixed this.

I thought I would update how I hacked the response to get what I expected. I got the responseData from the soap object, removed the soap header and trailer information, converted &lt; to < and &gt; to >. Below is a sample code snippet.

Tim...

php Syntax (Toggle Plain Text)
  1. $response = $soap->responseData;
  2. // force clean up the soap junk
  3. // find the position of the soap:Body location.
  4. $leadin = '<soap:Body>';
  5. $pos = strpos($response, $leadin);
  6. if ($pos !== false) {
  7. $response = substr($response, $pos + strlen($leadin));
  8. }
  9. $leadout = '</soap:Body></soap:Envelope>';
  10. $response = substr($response, 0, 0 - strlen($leadout));
  11. // now change all &lt; and &gt; to < and >
  12. $response = str_replace('&lt;',"<",$response);
  13. $response = str_replace('&gt;',">",$response);
  14. // and get rid of the xml encoding buried in the response.
  15. $response = str_replace('<?xml version="1.0" encoding="UTF-8"?>',"",$response);
  16. // now throw it into a simplexml object
  17. $SExml = new SimpleXMLElement($response);
Reputation Points: 10
Solved Threads: 0
Newbie Poster
mitcrellim is offline Offline
2 posts
since Jan 2010

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Standard CSS formating for all browsers
Next Thread in PHP Forum Timeline: PHP Search options





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC