954,561 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Issues with Soap/XML/Nusoap/Stripped Slashes

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. Success

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

$args = array ("xml"=>$str); 
$client = new soapclient($url,"wsdl"); $results = $client->call("User_Data", $args);

Thanks again.

Edit/Delete Message

coolguy20
Newbie Poster
1 post since Jan 2009
Reputation Points: 10
Solved Threads: 0
 
pclfw
Junior Poster
133 posts since Jun 2005
Reputation Points: 33
Solved Threads: 9
 

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.

mitcrellim
Newbie Poster
2 posts since Jan 2010
Reputation Points: 10
Solved Threads: 0
 

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 < to < and > to >. Below is a sample code snippet.

Tim...

$response = $soap->responseData;
  // force clean up the soap junk
  // find the position of the soap:Body location.
  $leadin = '<soap:Body>';
  $pos = strpos($response, $leadin);
  if ($pos !== false) {
    $response = substr($response, $pos + strlen($leadin));
  }
  $leadout = '</soap:Body></soap:Envelope>';
  $response = substr($response, 0, 0 - strlen($leadout));
  // now change all &lt; and &gt; to < and > 
  $response = str_replace('&lt;',"<",$response);
  $response = str_replace('&gt;',">",$response);
  // and get rid of the xml encoding buried in the response.
  $response = str_replace('<?xml version="1.0" encoding="UTF-8"?>',"",$response);
  // now throw it into a simplexml object
  $SExml = new SimpleXMLElement($response);
mitcrellim
Newbie Poster
2 posts since Jan 2010
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You