I've got a project in front of me that requires me to build a Soap Client in PHP and pass with the call/request a basic authorization. The client's WSDL doesn't specify a header. This is throwing me off because the basic authorization is needed to access the API in order to use the webservice (a simple user lookup).
This is my code:
<
?php
try {
$fullname = "Joe Smith";
$zipcode = "33149";
$session = "1a2b3c4d5e6f";
$client = new SoapClient('example.wsdl', array('location'=>'https://webservice/location', 'username'=>"Green", 'password'=>"tearocks"));
$search = $client->userSearch($session, $fullname, $zipcode);
print $search;
} catch (SoapFault $e) {
echo $e->faultstring;
}
?>
The result displays "Unauthorized Request", a 401 error. I've gone through the php.net manual and various ebooks without avail. Any thoughts?