繁体   English   中英

带有身份验证的php SoapClient请求

[英]php SoapClient Request with authentication

我正在尝试提出一个简单的要求。 它现在可以在SoapUI中尝试转移到php。

SoapUI生成信封(此方法有效):

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:HPD_IncidentInterface_WS">
   <soapenv:Header>
      <urn:AuthenticationInfo>
         <urn:userName>USERNAME</urn:userName>
         <urn:password>PASSWORD</urn:password>
         <!--Optional:-->
         <urn:authentication>?</urn:authentication>
         <!--Optional:-->
         <urn:locale>?</urn:locale>
         <!--Optional:-->
         <urn:timeZone>?</urn:timeZone>
      </urn:AuthenticationInfo>
   </soapenv:Header>
   <soapenv:Body>
      <urn:HelpDesk_QueryList_Service>
         <urn:Qualification></urn:Qualification>
         <urn:startRecord></urn:startRecord>
         <urn:maxLimit>10</urn:maxLimit>
      </urn:HelpDesk_QueryList_Service>
   </soapenv:Body>
</soapenv:Envelope>

php :(我可以运行$ fcs = $ client-> __ getFunctions();并获取函数,但$ result函数不会运行。不会收到错误消息)

$client = new SoapClient($url,array("userName" => $username, "password" => $password));
$result = $client->HelpDesk_QueryList_Service(array('Qualification' => '', 'startRecord' => '','maxLimit' => '10'));

进行了更多的搜索和测试,并获得了连接的编写代码。

$client = new SoapClient($url);
$headerbody = array('userName' => $username, 
                    'password' => $password,
                    'authentication'=>'',
                    'locale'=>'',
                    'timeZone'=>'');     
$header = new SOAPHeader($ns, 'AuthenticationInfo', $headerbody);        
$client->__setSoapHeaders($header)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM