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

报告相同问题?

悬赏问题

  • ¥30 VMware 云桌面水印如何添加
  • ¥15 用ns3仿真出5G核心网网元
  • ¥15 matlab答疑 关于海上风电的爬坡事件检测
  • ¥88 python部署量化回测异常问题
  • ¥30 酬劳2w元求合作写文章
  • ¥15 在现有系统基础上增加功能
  • ¥15 远程桌面文档内容复制粘贴,格式会变化
  • ¥15 这种微信登录授权 谁可以做啊
  • ¥15 请问我该如何添加自己的数据去运行蚁群算法代码
  • ¥20 用HslCommunication 连接欧姆龙 plc有时会连接失败。报异常为“未知错误”