2014-09-29 2 views
0

SOAP API 작업을 처음 수행하고 있습니다. 다음과 같이 TriSource에서 SOAP API를 호출해야합니다.Soapclient를 사용하여 Soap 웹 서비스를 호출하십시오.

아래 코드는 무엇이 문제인지 알 수 없습니다.

<?php 

$wsdl = "https://www.nobel-net.com/TSS_LOAD/TSS_LOAD.asmx?WSDL";// getcwd().'/TriSource.wsdl'; 
$options  = array('soap_version' => SOAP_1_2, 'trace' => 1, 'exceptions' => 1); 
$client = new SoapClient($wsdl, $options); 
// output of : var_dump($client->__getFunctions()); 
// array (size=4) 
// 0 => string 'SandboxResponse Sandbox(Sandbox $parameters)' (length=44) 
// 1 => string 'BoardResponse Board(Board $parameters)' (length=38) 
// 2 => string 'SandboxResponse Sandbox(Sandbox $parameters)' (length=44) 
// 3 => string 'BoardResponse Board(Board $parameters)' (length=38) 
$xmlBody = 'this is a long xml stirng'; 

try 
{ 
    $args = new SoapVar(new SoapVar($xmlBody, XSD_ANYXML),SOAP_ENC_OBJECT); 

    // alternate try 
    // $args = array(new SoapVar($xmlBody, XSD_ANYXML)); 

    $res = $client->Sandbox($args); 
} 
catch (SoapFault $e) 
{ 
    var_dump($e); 
} 

항상 다음과 같은 비누 오류가 발생합니다.

object(SoapFault)[4] 
protected 'message' => string 'System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> TSS_Load+ProgramError: Error writing Usage log. 
Object reference not set to an instance of an object. 

at TSS_Load.XML_Reader.AddLog(String Usage, String UserID, String Result, String Data) in c:\inetpub\wwwroot\TSS_LOAD\App_Code\TSS_Load.cs:line 3365 
at TSS_Load.Sandbox(String sData) in c:\inetpub\wwwroot\TSS_LOAD\App_Code\TSS_Load.cs:line 44 
--- End of inner exception stack trace ---' (length=485) 

답변

0

내 실수를 찾았습니다. SOAP 인수를 잘못된 방법으로 준비하고있었습니다. wsdl에 따라 샌드 박스 유형은 아래와 같습니다.

// Class with sData string member 
class Sandbox 
{ 
    string sData; 
} 

아래와 같이 SOAP 변수가 있습니다.

// PHP code 
$args = array('sData'=>new SoapVar($xmlBody, XSD_ANYXML)); 
관련 문제