Re: Passing XML String to Webservice

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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  "&lt;" and
> "&gt;"
> 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!

-- 
PHP Soap Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Kernel Newbies]     [PHP Database]     [Yosemite]

  Powered by Linux