2016-07-13 3 views
0

SoapUI와 같은 일부 도구로 SOAP API를 성공적으로 응답하고 있습니다. deltek API를 개발 중입니다. 다음PHP에서 SOAP 클라이언트를 통해 SOAP API를 호출하는 방법

내가 PHP에서 SOAP 클라이언트를 통해 API를 호출하고 때 내가 SoapUI

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:del="http://tempuri.org/Deltek.Vision.WebServiceAPI.Server/DeltekVisionOpenAPIWebService"> 
    <soap:Header/> 
    <soap:Body> 
     <del:GetSchema> 
     <!--Optional:--> 
     <del:ConnInfoXML><![CDATA[<VisionConnInfo> 
<databaseDescription>Example_Test (TEST_001)</databaseDescription> 
<userName>test</userName> 
<userPassword>test123</userPassword> 
<integratedSecurity>Y</integratedSecurity> 
</VisionConnInfo>]]> </del:ConnInfoXML> 

     <!--Optional:--> 
     <del:InfoCenter><![CDATA[User]]></del:InfoCenter> 
     </del:GetSchema> 
    </soap:Body> 
</soap:Envelope> 

에 사용하지만 오전 코드 형식입니다.

$apiURL = 'http://example.com/Vision/VisionWS.asmx?wsdl'; 
$client = new SoapClient($apiURL, array('trace' => 1, 'exceptions' => 1)); 

$conninfo = array(
      'ConnInfoXML' => array(
      'VisionConnInfo' => array(
       "databaseDescription" => 'Example_Test (TEST_001)', 
       "userName" => "test", 
       "userPassword" => 'test123', 
       "integratedSecurity" => "Y" 
       ) 
      ) 
     ); 

$userinfo = array('InfoCenter' => 'User'); 

try { 

    $result = $client->GetSchema($conninfo, $userinfo); 
} catch (SoapFault $fault) { 
    print_r($fault); 
} 

echo '<pre>'; 
print_r($result); 

제안하십시오 :

stdClass Object 
(
    [GetSchemaResult] => ErrLoginValInvalid login. Please change the username or password and try again.Value cannot be null. 
Parameter name: sGetSchema.validateVisionLogin.VisionWSUtil.ValidateVisionLogin 
) 

내 PHPcode입니다 :이 오류는 무엇입니까? 내가 실수로 어디에서?

답변

0

요청을 신중하게 살펴보면 요소 del:ConnInfoXML에 문자열이 포함되어 있음을 알 수 있습니다.

'ConnInfoXML' => '<VisionConnInfo>...</VisionConnInfo>'; 

프로그래밍 문자열을 만들어 값을 탈출해야합니다, 결과 XML이 유효 있도록 :

당신은 너무 문자열로 ConnInfoXML을 설정해야합니다, 그것이 작동되도록합니다.

관련 문제