PHP Soap 身份验证标头

编程入门 行业动态 更新时间:2024-10-24 22:22:09
本文介绍了PHP Soap 身份验证标头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

样品请求:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap/soap/envelope/" xmlns="https://ws.intermedia/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/WebServices/Account/AccountService.asmx?WSDL

PHP:

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

    $wsdl = "https://controlpanel.msoutlookonline/WebServices/Account/AccountService.asmx?WSDL";
    $ns = 'https://ws.intermedia/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);

我收到以下错误消息:

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

有人能看出代码有什么问题吗?

Can anyone see anything wrong with the code?

推荐答案

我的命名空间不正确.

此外,Mikaël DELSOL 的回答也有所帮助,因为我不需要 array('AuthentificationInfo'=> 部分.也不需要:$client->__soapCall("echoVoid", array(null));

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));

谢谢!

这篇关于PHP Soap 身份验证标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-18 06:04:53,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/932781.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:身份验证   PHP   Soap

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!