2

I have working on the SOAP Request With CURL in PHP Password and Username over there but API is needed One Extra Filed of ConfigurationName, I have added this in Header but the Response is showing me an Error of

FailedAuthentication

Following is my header code please check:

$headers=array(
"Content-type:text/xml;charset=\"utf-8\"",
"Accept:text/xml",
"Cache-Control:no-cache",
"Pragma:no-cache",
"SOAPAction:\"actionurl\"",
"Content-length:".strlen($xml_post_string),
"ConfigurationName: ConfigurationName",
);

$url=$soapUrl;
$ch=curl_init();
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,0);
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch,CURLOPT_USERPWD,$soapUser.":".$soapPassword);//usernameandpassword-declaredatthetopofthedoc
curl_setopt($ch,CURLOPT_HTTPAUTH,CURLAUTH_ANY);
curl_setopt($ch,CURLOPT_TIMEOUT,100);
curl_setopt($ch,CURLOPT_POST,true);
curl_setopt($ch,CURLOPT_POSTFIELDS,$xml_post_string);//theSOAPrequest
curl_setopt($ch,CURLOPT_HTTPHEADER,$headers);

Please assist me how to add this extra value of ConfigurationName in header.

Tarun modi
  • 1,040
  • 1
  • 10
  • 29

1 Answers1

3

I have fond the solution for this now I have set the ConfigurationName in xml like following and my script is working now:

$xml_post_string .='<soap:Header>';
$xml_post_string .='<UserID></UserID>';
$xml_post_string .='<Password></Password>';
$xml_post_string .='<ConfigurationName></ConfigurationName>';
$xml_post_string .='</soap:Header>';
Tarun modi
  • 1,040
  • 1
  • 10
  • 29