Re: ext/soap handing of header params

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

 




On Mar 18, 2005, at 12:29 PM, Adam Maccabee Trachtenberg wrote:

On Fri, 18 Mar 2005, George Schlossnagle wrote:

these binding.operation.input.header blocks are currently
a) entering the proxy classes call prototype
b) not being put into the actual soap envelope as headers but as body
nodes.

This is clearly broken.  As I see it one of two things need to occur:

a) drop the header params from the proxy class's method prototype and
require they be set by hand. (ick, imho)
b) have php correctly integrate them into the request as headers.

I would prefer (b). I do a lot of (a) right now, which I don't like because it's, well, ick.

The one redeeming quality is that once I've built up the header, I can
stash it someplace and ignore it. What I dislike is that I can no
longer use the overloaded method syntax (because there's no way to set
headers, only parameters), so I'm forced to do:

$user = $client->__soapCall('GetUser', array($params), NULL, $header);

Instead of:

$user = $client->GetUser($params);

(I think I can probably work around this by subclassing SOAPClient and
doing some __call() magic of my own, but it's not the best solution, IMHO.)


In my ideal world, I would be able to do something like:

$client = new SOAPClient('foo.wsdl');
$client->__setHeaders($headers);
$client->GetUser($params);

I think trying to have ext/soap figure out what values are SOAP
headers and what are SOAP parameters may require a little too much
magic. (And what happens when a header and a parameter have the same
name?)

Also, I generally find I set the headers once per client and then make
multiple client calls without modifying them, so a "set it once and
forget it" method works best in this situation.

So the problem is that if I point SoapClient at the wsdl fragment I showed above, this is what the proxy class wants to be:


SessionCreateRQ(MessageHeader $header, Security $header2, SessionCreateRQ $body)

So it requires me to pass in the two headers into the function, but then stashes them in the SOAP:Body. Which is what's broken. So to make b) work, soap would be changed to realize that $header and $header2 are SOAP:Headers (not too hard), and then to auto-set them to SOAP headers. The only other option I see is to drop them from the auto-prototyping completely, and then set them manually (perhaps via your construct).


PS: Dimity @ Zend does almost all of the ext/soap work, but I never see him on this list.

Then he should join this list. I've added him to the cc:

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