Re: WS-Security headers in PHP::SOAP and PEAR::SOAP

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

 



> Thanks Adam, that does the job. Recap:
> If you need a SOAP header looking like this...
> 
> <nsx:Security>
>   <nsx:UsernameToken>
>     <nsx:Username>MYUSERNAME</nsx:Username>
>     <nsx:Password>MYPASSWORD</nsx:Password>
>   </nsx:UsernameToken>
> </nsx:Security>
> 
> ...get it like this:
> 
> // Define WSSE_URL (converted to nsx:) as your namespace pointer
> class UPCombo {
>    private $Username;
>    private $Password;
>    public function __construct($NewUsername, $NewPassword) {
>       $this->Username = new SoapVar($NewUsername, XSD_STRING, 
>                                     null, null, 
>                                     'Username', WSSE_URL);
>       $this->Password = new SoapVar($NewPassword, XSD_STRING, 
>                                     null, null, 
>                                     'Password', WSSE_URL);
>    }
> }
> 
> class WSSE_UsernameToken {
>    private $UsernameToken;
>    public function __construct($NewUPCombo) {
>       $this->UsernameToken = new SoapVar($NewUPCombo, SOAP_ENC_OBJECT, 
>                                          null, null, 
>                                          'UsernameToken', WSSE_URL);
>    }
> }
> 
> $mySoapHeader_NameSpace      = WSSE_URL;
> $mySoapHeader_Name           = "Security";
> $myUPCombo                   = new UPCombo('MYUSERNAME', 'MYPASSWORD');
> $mySoapHeader_Data           = new WSSE_UsernameToken($myUPCombo);
> $mySoapHeader_MustUnderstand = true;
> 
> $mySoapHeader = new SoapHeader($mySoapHeader_NameSpace, 
>                                $mySoapHeader_Name,
>                                $mySoapHeader_Data,
>                                $mySoapHeader_MustUnderstand);
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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