2013-08-29 33 views
1

我在嘗試進行soap調用時出現此錯誤。使用soapClient時的SOAP操作錯誤

The SOAP action specified on the message, '', does not match the HTTP SOAP Action. 

當我打電話$service->SearchTouristItems($sti);(該功能下文)我得到上面的錯誤,我不知道爲什麼。

以下是我正在使用的代碼。

//我用http://www.urdalen.no/wsdl2php/創建延伸SoapClient的

$service = new TCS2Service() ; 

$sd = new ServiceDescriptor; 
$sd->UniqueIdentifier = 'xxxxxxxxx-xxxxx-xxxx-xxxxx-xxxxxx'; 

$stic = new SearchTouristItemCriteria; 
$stic->SearchString = array ('dublin') ;  

$sti = new SearchTouristItems; 

$sti->searchTouristItemCriteria = $sd; 
$sti->serviceDescriptor = $stic; 

$result = $service->SearchTouristItems($sti); 

    echo "<pre>"; 
    print_r($result); 
    echo "</pre>"; 



SearchTouristItems looks like this 
    /** 
    * 
    * 
    * @param SearchTouristItems $parameters 
    * @return SearchTouristItemsResponse 
    */ 
    public function SearchTouristItems(SearchTouristItems $parameters) { 
    return $this->__soapCall('SearchTouristItems', array($parameters),  array(
      'uri' => 'http://tempuri.org/', 
      'soapaction' => '' 
      ) 
    ); 
    } 

TCS2Service這是客戶端

public function TCS2Service($wsdl = "http://www.example.com/services/TCS2Service.svc", $options = array('soap_version' => SOAP_1_2, 
      'exceptions' => true, 
      'trace'   => 1, 
      'cache_wsdl' => WSDL_CACHE_NONE,)) { 
    foreach(self::$classmap as $key => $value) { 
    if(!isset($options['classmap'][$key])) { 
     $options['classmap'][$key] = $value; 
    } 
    } 
    parent::__construct($wsdl, $options); 
} 
+0

你的ins 'SoapClient'看起來是在wsdl-mode中......那麼你爲什麼使用'__soapCall'?那個僞魔術方法主要用於非wsdl模式的調用。如果你傳遞一個wsdl,客戶端會爲你生成方法__。 –

+0

SoapClient由wsdl2php生成,因此此方法也由wsdl2php生成。 – molleman

回答

0

不知道,雖然的動初始化,但什麼是'soapaction' => ''在代碼中值用提供的參數替換。我沒有使用PHP調用Web服務的經驗,所以只是給了它一個想法。

0

我認爲你的ws-addressing沒有打開。請打開ws- 尋址並再次檢查。

+0

如何打開ws-addressing – molleman

+0

請通過此鏈接查看http://www.dimuthu.org/blog/2008/11/26/5-facts-about-ws-addressing-action-in-wsfphp/ – rohitcopyright

0

我會怎麼做:

  • 檢查如果SOAP動作在WSDL定義明確:尋找address location="

  • 嘗試另一個WSDL到PHP的轉換器

  • 發送WSDL url所以我可以在我身邊試試