dongnu4254 2017-03-27 11:52 采纳率: 100%
浏览 62
已采纳

如何在SOAP请求的curl头中添加ConfigurationName

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.

  • 写回答

1条回答 默认 最新

  • douyiyi5284 2017-04-27 06:47
    关注

    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>';
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入