Hi All
I am very much new to PHP and facing the problem like below.
I am facing problem in calling WCF Service from PHP using SoapClient along with network credentials.
Used below code to get the results from WCF service and getting the error copied below the code. Please help me in this Regard. thanks in advance for your help
Code
$client = new SoapClient("https://api.xdpart.net/CMAPI_SANDBOX/V1_1/SOAP/App.svc?wsdl");
$sh_param = array( 'UserName' => 'xdpartAPI@satya.com',
'Password' => 's@vas');
$headers = new SoapHeader('https://api.xdpart.net/CMAPI_SANDBOX/V1_1/SOAP/App.svc', 'UserCredentials', $sh_param);
$client->__setSoapHeaders(array($headers));
$answer = $client->GetAdvertisers();
Results
Fatal error: Uncaught SoapFault exception: [HTTP] Unauthorized in C:\wamp\www\ADVT\AppCall.php:22 Stack trace: #0 [internal function]: SoapClient->doRequest('<?xml version="...', 'https://api.dtp...', 'http://tempuri....', 1, 0) #1 [internal function]: SoapClient->call('GetAdvertisers', Array) #2 C:\wamp\www\ADVT\AppCall.php(22): SoapClient->GetAdvertisers() #3 {main} thrown in C:\wamp\www\ADVT\AppCall.php on line 22
Once again thanks in advance for your help
Satya