2014-09-08 2 views
0

간단한 요청을하려고합니다. 그것은 지금 PHP로 전송하려고 SoapUI에서 작동합니다.php SoapClient 인증 요청

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를 실행할 수 있습니다 = $ 클라이언트 -> __ getFunctions();와 기능을 얻을 수 있지만, $ 결과 기능을 못해 실행 얻기. 오류 메시지)

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

멍청한 내가 PHP 로그를 생각하지 않았다. [2014 년 9 월 8 일 17:28:04 America/Denver] PHP 치명적 오류 : 잡히지 않은 SoapFault 예외 : [soapenv : Server.userException] ARERR [149] D : \의 제어 레코드에 사용자 이름을 제공해야합니다.스택 추적 : # 0 D : \ LeprinoNetDev \ serviceDesk \ webServiceTest \ index.php (16) : SoapClient -> __ call ('HelpDesk_Query _...', Array) # LeprinoNetDev \ serviceDesk \ webServiceTest \ index.php 1 D : \ LeprinoNetDev \ serviceDesk \ webServiceTest \ index.php (16) : SoapClient-> HelpDesk_Query_Service (Array) # 2 {main} D : \ LeprinoNetDev \ serviceDesk \ webServiceTest \ index.php – Jeffha77

답변

0

검색 및 테스트 많게하지 않았다 및 연결에 대한 쓰기 코드를 얻었다.

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