Re: SOAP_Header namespace missing

From: Date: Wed, 09 Apr 2003 17:10:31 +0000
Subject: Re: SOAP_Header namespace missing
References: 1  Groups: php.soap 
Request: Send a blank email to php-soap+get-535@lists.php.net to get a copy of this message
You should try (without your SOAP_Header patch): $header =& new SOAP_Header('{http://www.pma.co.uk/DD01WS/AuthenticationService/}TokenHeader','Struct',array('InnerToken' => $this->userToken), false)); $this->addHeader($header); If that does not work, you do this: $header =& new SOAP_Header('TokenHeader','Struct',array('InnerToken' => $this->userToken), false)); $header->attributes['xmlns']='http://www.pma.co.uk/DD01WS/AuthenticationService/'; $this->addHeader($header); Shane Mike Carter wrote:
Hi guys, First off, sorry if thie has been discussed - is there any plans to get this list available in searchable archive form on php.net yet? I'm not even sure if this mailing list is to do with the PEAR:SOAP or the PECL:SOAP implementation for PHP? I've got a problem between PHP and a MS .NET webservice. PHP is acting as a client here, using rhe PEAR::SOAP package. The .NET webservice server requires a certain value sent in the header of every SOAP request. I can do this fine using: $this->addHeader(new SOAP_Header('TokenHeader', 'Struct', array('InnerToken' => $this->userToken), false));
However the .NET webservice is refusing to accept this header because it is missing an associated namespace attribute in the serialized XML being produced by the PEAR:SOAP class. For a test I hardcoded my personal test namespace (xmls) into the SOAP_Header class constructor:
    function SOAP_Header($name = '', $type, $value = NULL,
                         $mustunderstand = 0,
                         $actor =
'http://schemas.xmlsoap.org/soap/actor/next' )
    {
        parent::SOAP_Value($name, $type, $value);
        $this->attributes['SOAP-ENV:actor'] = $actor;
        $this->attributes['SOAP-ENV:mustUnderstand'] = (int)$mustunderstand;
        $this->attributes['xmlns'] =
"http://www.pma.co.uk/DD01WS/AuthenticationService/";
    }
This worked brilliant and the .NET side didn't refuse my web service method request. However I really do not know how to make the SOAP_Header get the xmlns attribute dynamically. I talk to a number of different webservices, in different namespaces, and they all need the special header sending along with the request. As I am not totally familiar with the large amount of code in the PEAR:SOAP pacakge right now (and don't have time to start learning it due to a deadline at work) I was wondering if anybody has managed to solve this issue - or knows the code well enough to produce an officail fix for the problem? Kind regards,


« previous php.soap (#535) next »