2015-04-29 75 views
0

我有一個SOAP客戶端代碼來從elit公司獲得汽車零件,但我有一個奇怪的結果。Soap失敗函數響應

object(stdClass)[225] 
    public 'return' => 
    object(stdClass)[226] 
     public 'unitPrice' => float 0 
     public 'vat' => int 0 

我的PHP代碼:

getItem function must have an array parameters:

7 => string 'struct getItem { 
    string company; 
    string login; 
    string password; 
    string activeItemNo; } 

public function demo($piesa) 
{ 

    $wsdl = 'http://icelit02.elit.cz:7606/InterCompany-1.10.0/BuyerService?wsdl'; 
    $opts = array('http' => array('protocol_version' => '1.0')); 
    $context = stream_context_create($opts); 
    $client = new SoapClient($wsdl, array('stream_context' => $context)); 


    var_dump($client->__getFunctions()); 
    var_dump($client->__getTypes()); 
    $response=$client->__call('getItem', array(array('company'=>'ELIT_RO', 'login'=>'autocomplet15', 'password'=>'elena10', 'activeItemNo'=>'M043 22 00'))); 
    dd($response); 
    } 
+0

你可以直接調用'$ client-> getItem($ arguments)'。你也可以顯示'__getFunctions'結果嗎?請注意在此處顯示您的密碼。 –

+0

我相信,你不應該使用嵌套數組,只是簡單的數組作爲一個基礎:'$ response = $ client-> getItem(array('company'=>'ELIT_RO','login'=>'login','password '=>'password','activeItemNo'=>'M043 22 00'));' –

+0

Honza Haering:如果我直接調用getItem,我收到一個錯誤:Function not found ...或類似的東西。 –

回答

0

'activeItemNo'=>'M043 22 00'該項目並不在目錄中存在。嘗試一些現有的,例如'activeItemNo'=>'ATE 390569'

+0

非常感謝您的回答 –