2013-06-24 42 views
0

我有一個網站,其中包含一個表格,在某些點上發出各種SOAP請求。其中一個請求獲得返回的歸納時間列表,並將其顯示給用戶以便他們選擇一個。 我得到的結果很好地從SOAP服務返回,但不幸的是它似乎沒有正確顯示信息,甚至根本不顯示返回的對象鍵。 我已經與SOAP端的開發人員聯繫了,他說服務很好,並且吐出了正確的信息。他提供了一個screentshot:SOAP錯誤。沒有得到正確的結構返回

enter image description here

這裏是我的代碼拉叫我需要此信息的方法:

public function getInductionTimes($options) { 
     $client = $this->createSoapRequest(); 
     $inductionTimes = $client->FITinductionlist($options); 
     //die(print_r($inductionTimes)); 
     return $inductionTimes; 
    } 

    private function createSoapRequest() { 
     $url = 'https://fitspace.m-cloudapps.com:444/FITSPACE/MHservice.asmx?WSDL'; 
     $options["connection_timeout"] = 25; 
     $options["location"] = $url; 
     $options['trace'] = 1; 
     $options['style'] = SOAP_RPC; 
     $options['use'] = SOAP_ENCODED; 

     $client = new SoapClient($url, $options); 
     //die(print_R($client->__getFunctions())); 
     return $client; 
    } 

正如你可以看到我的print_r我收到後右邊的代碼它來檢查我被退回了我,它是這樣的:

enter image description here

正如你可以看到這IDdtstring字段被完全忽略。 有沒有人有任何想法,爲什麼這可能會發生?這與編碼有關嗎?我似乎無法解決這個問題! 謝謝

回答

0

我能夠使用您的基本代碼正確檢索字段,包括IDdtstring。也許你沒有正確地發送參數?

function getInductionTimes($options) { 
    $client = createSoapRequest(); 
    $inductionTimes = $client->FITinductionlist($options); 
    die(print_r($inductionTimes)); 
    return $inductionTimes; 
} 

function createSoapRequest() { 
    $url = 'https://fitspace.m-cloudapps.com:444/FITSPACE/MHservice.asmx?WSDL'; 
    $options["connection_timeout"] = 25; 
    $options["location"] = $url; 
    $options['trace'] = 1; 
    $options['style'] = SOAP_RPC; 
    $options['use'] = SOAP_ENCODED; 

    $client = new SoapClient($url, $options); 
    //die(print_R($client->__getFunctions())); 
    return $client; 
} 

getInductionTimes(array("IDDate" => "2013-06-28T13:00:00+01:00", "GYMNAME" => "Bournemouth")); 
0

我設法通過添加一行代碼到我的SOAP選項數組,然後我推測是被緩存在PHP與我的WSDL的問題來解決這個問題:

$選項[「cache_wsdl」] = WSDL_CACHE_NONE;