php SoapClient请求验证

时间:2014-09-08 22:34:49

标签: php soap

我试图提出一个简单的请求。它现在在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-&gt; __ getFunctions();并获取函数,但$ result函数不会运行。没有错误信息)

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

1 个答案:

答案 0 :(得分:0)

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

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