Re: [SOAP] SOAP client issue: < & > removed from XML payload

[email protected] (Stephen Gray)
Newsgroups php.soap
Message-ID <[email protected]>
Hi everyone,

Thanks for the replies. However the problem is not that the browser 
doesn't display XML tags. If you try to display XML in a browser it will 
not display the tags and just display what is between the tags. This is 
not what is happening. What is happening is that the angle brackets are 
being removed by SOAP client, so <tag1><tag2>value</tag2></tag1> is 
converted to tag1tag2value/tag2/tag1. This is what you get even if you 
use var_dump() and write to disk.

By the way I am using the latest version of PHP SOAP (0.12.0).

Would be very grateful for any help. This is a huge problem for us as it 
has completely broken our application.

Thanks,
Steve


David Zülke wrote:
> Am 07.01.2009 um 07:01 schrieb Stephen Gray:
> 
>> I am sure this is a problem with the PHP client not the server, as 
>> when I replaced the PHP client with a Perl client the problem went away.
> 
> It's not, the problem is you.
> 
> You are echo'ing something that looks like HTML. Your browser does not 
> display the tags.
> 
> Use var_dump() instead of echo() or view the page source...

ORIGINAL MESSAGE:
Hi everyone,

I've got a problem with a program using a PHP SOAP client that gets XML 
from a Perl SOAP server. The problem is that the angle brackets (< and 
 >) are removed from the XML sent by the server by the SOAP client. I am 
sure this is a problem with the PHP client not the server, as when I 
replaced the PHP client with a Perl client the problem went away.

The code for the PHP client is as follows:

__START CODE__
<?php
     require_once 'SOAP/Client.php';

     $endpoint = "http://localhost/cgi-bin/test.pl";
     $soapoptions = array('namespace' => 'urn:Test',
                  'trace' => 1,
                  'timeout' => 600);
     $soapclient = new SOAP_Client($endpoint);

     $params = "";
     $response = $soapclient->call('Main', $params, $soapoptions);
?>

<html>
<head>
</head>
<body>
<p>
<?php
     echo $response;
?>
</p>
</body>
</html>
__END CODE__

Just in case it's relevant the code for the Perl server is:

__START CODE__
#!/usr/bin/perl -w
use SOAP::Transport::HTTP;
use Test;

SOAP::Transport::HTTP::CGI
     -> dispatch_to('Test')
         -> handle;

package Test;

sub Main {
     return "<tag1><tag2>testing</tag2></tag1>";
}
__END CODE__

Does anyone have any idea what might be the problem? Any help much 
appreciated.

Thanks,
Steve Gray
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.