dongshen2903 2013-09-17 21:33
浏览 82
已采纳

PHP Soap身份验证标头

Sample Request:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="https://ws.intermedia.net/Account/Management">

<soapenv:Header>
  <AuthentificationInfo>
     <login>[PLRAdminUserName]</login>
     <password>[PLRAdminPassword]</password>
     <accountID>[accountID]</accountID>
  </AuthentificationInfo>
</soapenv:Header>
<soapenv:Body>
  <GetAccount>
     <accountID>[accountID]</accountID>
  </GetAccount>
</soapenv:Body>
</soapenv:Envelope>

WSDL: https://controlpanel.msoutlookonline.net/WebServices/Account/AccountService.asmx?WSDL

PHP:

    ini_set("soap.wsdl_cache_enabled", "0");

    $wsdl = "https://controlpanel.msoutlookonline.net/WebServices/Account/AccountService.asmx?WSDL";
    $ns = 'https://ws.intermedia.net/Account/Management';

    $client = new SoapClient($wsdl, array(
        "trace" => 1,
        "exceptions" => 0
    ));

    $login = 'xxxx';
    $password = 'xxxx';
    $partnerID = 1234;
    $accountID = 12345678;

    $headerBody = array('AuthentificationInfo'=>array(
        'login' => $login,
        'password' => $password,
        'accountID' => $partnerID
    ));
    $header = new SoapHeader($ns, 'AuthentificationInfo', $headerBody);
    $client->__setSoapHeaders($header);
    $client->__soapCall("echoVoid", array(null));

    $value = $client->GetAccount($accountID);

I'm getting the following error message:

soap:ServerServer was unable to process request. ---> Access denied; Code: 0x0008

Can anyone see anything wrong with the code?

  • 写回答

3条回答 默认 最新

  • douzhai7873 2013-09-18 22:42
    关注

    I had an incorrect namespace.

    Also Mikaël DELSOL's answer helped as I didn't need the array('AuthentificationInfo'=> part. Also didn't need: $client->__soapCall("echoVoid", array(null));

    Thank you!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 乘性高斯噪声在深度学习网络中的应用
  • ¥15 运筹学排序问题中的在线排序
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥30 求一段fortran代码用IVF编译运行的结果
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥30 python代码,帮调试,帮帮忙吧