Re: [SOAP] Passing XML String to Webservice
| From: | Adam Maccabee Trachtenberg | Date: | Fri, 26 Aug 2005 07:37:42 +0000 |
| Subject: | Re: [SOAP] Passing XML String to Webservice | ||
| References: | 1 | Groups: | php.soap |
| Request: | Send a blank email to php-soap+get-1969@lists.php.net to get a copy of this message | ||
On Fri, 26 Aug 2005, Reinhard wrote:
> I have to pass an XML-String to a webservice.
>
> $client = new SoapClient($wsdl,array('trace'=>1,'exceptions'=>0));
> $result = $client->import($xml);
>
> The problem is, that SOAP or PHP replaces all "<" or ">" with
> "<" and
> ">"
> so that the SOAP HEader looks like:
[snip]
> I want to submit the XML as it is, without parsing.
That's not how SOAP works. You're supposed to let the SOAP client
handle the XML serialization.
You're supposed to do:
$params = array('username' => 'foo',
'password' => 'bar', /* ... */
)
$result = $client->import($params);
I don't know of a way to override SOAPClient this way. Well, maybe if
you hook into SoapClient::__doRequest() and overwrite the request XML,
but that's kludgy.
Yea, you could implement a __call() method which stashes the XML
someplace, calls the virtual method, then intercepts it in
__doRequest() and uses DOM to suck out the bad data and shove in the
XML you stashed away. I think. But I ain't coding it up to see. You
are on your own. :)
-adam
--
adam@trachtenberg.com | http://www.trachtenberg.com
author of o'reilly's "upgrading to php 5" and "php cookbook"
avoid the holiday rush, buy your copies today!