Re: RE: element handling in schema

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

 



On Sun, 27 Mar 2005, George Schlossnagle wrote:

> This is acceptable, but I'd like to take another shot at convincing you
> it's wrong.  The whole idea of wsdl is to allow a full generation of
> proxy classes.  With this, you can't.  You're forced to delve into
> complex machinations where you should just be calling a method name.
> It really reduces the elegance of the solution.

Agreed. It's a real pain to need to deciper the documentation to
create all the classes for your SOAP header with all the SoapVars and
SoapHeader elements.

For example:

class eBayCredentials {
        private $AppId;
        private $DevId;
        private $AuthCert;

        public function __construct($session) {
                $this->AppId = new SOAPVar($session->app, XSD_STRING,
                null, null, null, 'urn:ebay:apis:eBLBaseComponents');
                $this->DevId = new SOAPVar($session->dev, XSD_STRING,
                null, null, null, 'urn:ebay:apis:eBLBaseComponents');
                $this->AuthCert = new SOAPVar($session->cert,
                XSD_STRING, null, null, null, 'urn:ebay:apis:eBLBaseComponents');
        }
}

class eBayAuth {
        private $eBayAuthToken;
        private $Credentials;

        public function __construct($session) {
                $credentials = new eBayCredentials($session);
                $this->eBayAuthToken = new SoapVar($session->token,
                XSD_STRING, null, null, null, 'urn:ebay:apis:eBLBaseComponents');
                $this->Credentials = new SoapVar($credentials,
                SOAP_ENC_OBJECT, null, null, null, 'urn:ebay:apis:eBLBaseComponents');
        }
}


This isn't necessary the SOAP body, but is for the SOAP header.

What if we made it so the fourth parameter to __soapCall() was "smart"
in the same way that the first parameter was? In other words, if you
pass regular PHP variables, the client does its best to fit them into
the SOAP header structure and namespaces.

This would make it much simpler to write a wrapper method that didn't
involve manually defining PHP classes and using SOAPVars. I haven't
spent a lot of time looking at the extension source, but if it's
already happening for the SOAP body, I hope it won't be that hard to
add for the SOAP header.

-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