Personalize

is there a way to add some http headers on wsdl2php generated scripts?

Forums :

Hi,

I'm using wsdl2php.php generated scripts to make web service calls. Since the wsdl specified transport is http, is there a way through which I can add certain Http headers in the Http requests that are created by wsclient?

Something like

wsclientProxy->addHttpHeader(name,value)

What I want to add is a BASIC AUTH header. I'm perfactly willing to change wsdl2php.php generated client code.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

use "httpAuthUsername" and "httpAuthPassword" option from 1.3

Hi Gag,

You can use "httpAuthUsername" and "httpAuthPassword" with WSClient to specify basic authentication information from wsf/php 1.3 release (This would be released 12th May).

Here is how you may use this options.

    $client = new WSClient(array(

                     "to" => "http://localhost/service.php",

                    "httpAuthUsername" => "username",

                    "httpAuthPassword" => "password",

                    "httpAuthType" => "Basic"));

 

Anyway currently wsf/php still doesn't have a way to provide custom http headers. But I too think it will be really useful for most users. So I guess it should be a part of 1.4 release.

 

Thanks

Dimuthu

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.