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?

图片转代码服务由CSDN问答提供 功能建议

示例请求:

 &lt; soapenv:Envelope xmlns:  soapenv =“http://schemas.xmlsoap.org/soap/envelope/”xmlns =“https://ws.intermedia.net/Account/Management”&gt; 
 
&lt; soapenv:Header&gt; 
&lt;  AuthentificationInfo&gt; 
&lt; login&gt; [PLRAdminUserName]&lt; / login&gt; 
&lt; password&gt; [PLRAdminPassword]&lt; / password&gt; 
&lt; accountID&gt; [accountID]&lt; / accountID&gt; 
&lt; / AuthentificationInfo&gt  ; 
&lt; / soapenv:Header&gt; 
&lt; soapenv:Body&gt; 
&lt; GetAccount&gt; 
&lt; accountID&gt; [accountID]&lt; / accountID&gt; 
&lt; / GetAccount&gt; 
&lt; / soapenv:Body&gt  ; 
&lt; / soapenv:Envelope&gt; 
   
 
 

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

PHP: \ n

  ini_set(“soap.wsdl_cache_enabled”,“0”); 
 
 $ wsdl =“https:// c  ontrolpanel.msoutlookonline.net/WebServices/Account/AccountService.asmx?WSDL";
 $ ns ='https://ws.intermedia.net/Account/Management';
nn $ client = new SoapClient($ wsdl  ,array(
“trace”=&gt;  1,
“例外”=&gt;  0 
)); 
 
 $ login ='xxxx'; 
 $ password ='xxxx'; 
 $ partnerID = 1234; 
 $ accountID = 12345678; 
 
 $ headerBody = array('  AuthentificationInfo'=&gt;数组(
'登录'=&gt; $登录,
'密码'=&gt; $密码,
'accountID'=&gt; $ partnerID 
)); 
 $ header = new  SoapHeader($ ns,'AuthentificationInfo',$ headerBody); 
 $ client-&gt; __ setSoapHeaders($ header); 
 $ client-&gt; __ soapCall(“echoVoid”,array(null)); 
 
 $  value = $ client-&gt; GetAccount($ accountID); 
   
 
 

我收到以下错误消息:

   soap:ServerServer无法处理请求。  ---&GT; 拒绝访问; 代码:0x0008 
   
 
 

任何人都可以看到代码有什么问题吗?

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 收藏
  • 邀请回答

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

相关推荐 更多相似问题