2012-04-13 3 views
0

저는 비누로 일하는 것에 익숙하지 않습니다. 비누 서버에서 데이터를 가져 오려고했지만 문제가있는 것 같습니다 (개체 참조가 개체의 인스턴스로 설정되지 않았습니다.). 여기 내 코드의 디버그 코드 :개체 참조가 개체의 인스턴스로 설정되지 않았습니다. 내 코드를 확인하십시오

stdClass Object ([GetSalesBannersResult] => stdClass Object ([Result] => [Message] => Object reference not set to an instance of an object. [List] => stdClass Object ())) 
Request :<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://ws.ozsale.com.au/API/V2"><SOAP-ENV:Body><ns1:GetSalesBanners><ns1:saleCategoryID>40F80218-A9E1-43C4-96FF-4C046D192A21</ns1:saleCategoryID><ns1:getTopThree>true</ns1:getTopThree></ns1:GetSalesBanners></SOAP-ENV:Body></SOAP-ENV:Envelope> 

Response:<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><GetSalesBannersResponse xmlns="http://ws.ozsale.com.au/API/V2"><GetSalesBannersResult><Result>false</Result><Message>Object reference not set to an instance of an object.</Message><List /></GetSalesBannersResult></GetSalesBannersResponse></soap:Body></soap:Envelope> 

및 내 지금까지 코드 :

<?php 
// create a connection to the local host mono .NET pull back the wsdl to get the functions names 
    // and also the parameters and return values 
    $client = new SoapClient("http://www.ozsale.com.au/api/v2/api.asmx?WSDL", 
    array(
     "trace"  => 1, // enable trace to view what is happening 
     "exceptions" => 0, // disable exceptions 
     "cache_wsdl" => 0) 
); 

    // get a response from the WSDL zend server function getQuote for the day monday 
    print_r($client->GetSalesBanners(array(
    "saleCategoryID" => "40F80218-A9E1-43C4-96FF-4C046D192A21", 
    "getTopThree" =>"1" 
    )) 
); 
    //print_r($client); 

    // display what was sent to the server (the request) 
    echo "<p>Request :".htmlspecialchars($client->__getLastRequest()) ."</p>"; 
    // display the response from the server 
    echo "<p>Response:".htmlspecialchars($client->__getLastResponse())."</p>"; 
    ?> 

및 대한 다음 API 문서는 누구나 여부를 알아낼 도움이 될 수 http://www.ozsale.com.au/api/v2/api.asmx?op=GetSalesBanners

여기에있다 여기서 무엇이 잘못 되었습니까 ...


문제.

'saleCategoryID' => '40F80218-A9E1-43C4-96FF-4C046D192A21', 
'countryID'=> 'AS', 
'languageID'=> 'EN', 
'getTopThree' =>'1' 

내 코드는 여기에 있습니다 : : 이제 문서 API는 여기에 내가이 다음과 같은 정보와 데이터를 잡아 당기지 http://www.ozsale.com.au/api/v2/api.asmx?op=GetPublicSalesBanners

입니다

<?php 
// create a connection to the local host mono .NET pull back the wsdl to get the functions names 
    // and also the parameters and return values 
    $client = new SoapClient("http://www.ozsale.com.au/api/v2/api.asmx?WSDL", 
    array(
     "trace"  => 1, // enable trace to view what is happening 
     "exceptions" => 0, // disable exceptions 
     "cache_wsdl" => 0) 
); 

    // get a response from the WSDL zend server function getQuote for the day monday 
    print_r($client->GetPublicSalesBanners(array(
    'saleCategoryID' => '40F80218-A9E1-43C4-96FF-4C046D192A21', 
    'countryID'=> 'AS', 
    'languageID'=> 'EN', 
    'getTopThree' =>'1' 
    )) 
); 

    // display what was sent to the server (the request) 
    echo "<p>Request :".htmlspecialchars($client->__getLastRequest()) ."</p>"; 
    // display the response from the server 
    echo "<p>Response:".htmlspecialchars($client->__getLastResponse())."</p>"; 
    ?> 

그리고 나는 그것이 작동하는 방법을 참조 할 때, 다음과 같이 출력됩니다.

SoapFault Object ([message:protected] => Server was unable to process request. ---> There was an error generating the XML document. ---> <>f__AnonymousType2a`2[System.String,System.Object[]] cannot be serialized because it does not have a parameterless constructor. [string:Exception:private] => [code:protected] => 0 [file:protected] => /Users/resarahman/Documents/xampp/htdocs/testing/soap/test.php [line:protected] => 17 [trace:Exception:private] => Array ([0] => Array ([file] => /Users/resarahman/Documents/xampp/htdocs/testing/soap/test.php [line] => 17 [function] => __call [class] => SoapClient [type] => -> [args] => Array ([0] => GetPublicSalesBanners [1] => Array ([0] => Array ([saleCategoryID] => 40F80218-A9E1-43C4-96FF-4C046D192A21 [countryID] => AS [languageID] => EN [getTopThree] => 1)))) [1] => Array ([file] => /Users/resarahman/Documents/xampp/htdocs/testing/soap/test.php [line] => 17 [function] => GetPublicSalesBanners [class] => SoapClient [type] => -> [args] => Array ([0] => Array ([saleCategoryID] => 40F80218-A9E1-43C4-96FF-4C046D192A21 [countryID] => AS [languageID] => EN [getTopThree] => 1)))) [previous:Exception:private] => [faultstring] => Server was unable to process request. ---> There was an error generating the XML document. ---> <>f__AnonymousType2a`2[System.String,System.Object[]] cannot be serialized because it does not have a parameterless constructor. [faultcode] => soap:Server [detail] =>) 
Request :<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://ws.ozsale.com.au/API/V2"><SOAP-ENV:Body><ns1:GetPublicSalesBanners><ns1:saleCategoryID>40F80218-A9E1-43C4-96FF-4C046D192A21</ns1:saleCategoryID><ns1:countryID>AS</ns1:countryID><ns1:languageID>EN</ns1:languageID><ns1:getTopThree>true</ns1:getTopThree></ns1:GetPublicSalesBanners></SOAP-ENV:Body></SOAP-ENV:Envelope> 

Response:<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>Server was unable to process request. ---&gt; There was an error generating the XML document. ---&gt; &lt;&gt;f__AnonymousType2a`2[System.String,System.Object[]] cannot be serialized because it does not have a parameterless constructor.</faultstring><detail /></soap:Fault></soap:Body></soap:Envelope> 

왜 여기 왜 잘못 되었습니까?

답변

1

SOAP 헤더와 같은 특별한 요구 사항이없는 한 입력 내용이 정상적으로 보입니다. 이는 클라이언트 코드의 문제가 아니라 공급자가 고쳐야하는 웹 서비스의 문제 일 가능성이 큽니다. 그들에게 연락하는 것이 좋습니다.

+0

오. 고맙습니다.) 대답 –

+0

@ resa.r 답변이 도움이된다고 생각한다면 동의해야합니다. 답변 수신에 대한 자세한 내용은 다음을 참조하십시오. http://meta.stackexchange.com/questions/16721/how-does-accept-rate-work – poncha

관련 문제