Dmitry,
I also was looking at something similar, but I was thinking more along
the lines of using the php_libxml_import_node functionality within
libxml.c, which creates no dependency on either extension. Once ext/soap
registers handlers (one for the client and one for the server), it
should be possible to do something like:
$domdoc = dom_import_simplexml($soapClient);
or
$sxe = simplexml_import_dom($soapServer);
I know the function names here are a bit misleading but they were
created prior to making the import functionality more flexible and
easier to plug in additional extensions. (Might be time to create some
new function aliases for those).
It would take some thought to handle the interop of the document within
ext/soap, but definitely possible. Not something that I was going to be
looking at immediately, but thought I would toss this out now since the
topic came up.
Rob
Dmitry Stogov wrote:
Hi David,
Which kind of DOM do you mean?
Do you mean ext/simplexml or ext/dom?
I don't like make ext/soap dependent on them.
Btw you probably can simple make it in PHP itself with something like this.
class DomSoapClient extends SoapClient {
function __doDomRequest($dom) {
return string2dom($this->__doRequest(dom2string($dom),
...));
}
}
Isn't this enough for you?
Or may be I misunderstood you.
Thanks. Dmitry.
-----Original Message-----
From: David [mailto:me@contents.nl]
Sent: Thursday, May 11, 2006 11:42 PM
To: Dmitry Stogov
Cc: Peter De Vries; Paul Osman; soap@lists.php.net
Subject: Re: PHP5 SOAP Extension - Request Header
Elements with Attributes
Hi Dmitry,
I want to extend the soap server and client implementation with
functions that return the request (client) / response
(server) as a dom
document, instead of writing them to the output buffer. Capturing the
output buffer and re-loading it into a dom document is a waste of
resources.
There are several ways to achieve this:
1. Seperate function with the same parameters as handle() or
__call() 2. Add additional optional parameters or options to
in to handle() and
__call() which tell the function if it has to return the dom
document 3. Always return the dom document with handle() or
__call() 3. Use return_value_used to check if the function
has to write to the
output buffer or return the dom document.
What do you think about adding this functionality and which option do
you prefer?
Kind regards,
David
Peter De Vries wrote:
Have been struggling with something similar myself
recently. Support
for attributes is still limited. For now I solved it by
overriding the
__doRequest method of the SoapClient object, loading the
request into
a DOM object, make the required modifications and send.
It's a bit of
a hassle but it works fine. There's kind of an example on the
__doRequest manual page.
Peter.
--- Paul Osman <paul@eval.ca> wrote:
HI There,
I was wondering if there was a simple way to specify request header
elements with attributes using the PHP5 SOAP extension?
I've tried to
figure it out from the docs for the SoapHeader class, but
they're a
little unclear and I see no mention of attributes. What I need is
something like this:
<SOAP-ENV:Header>
<ns1:Security SOAP-ENV:mustUnderstand="1">
<ns2:Timestamp>
...
</ns2:Timestamp>
<ns1:UsernameToken>
<Username> ... </Username>
<Password Type="..."> ... </Password>
</ns1:UsernameToken>
</ns1:Security>
</SOAP-ENV:Header>
Notice the "Type" attribute of the "Password" element. Any
ideas? Any
help would be greatly appreciated.
Thanks,
Paul
--
PHP Soap Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php