我在嘗試進行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);
}
你的ins 'SoapClient'看起來是在wsdl-mode中......那麼你爲什麼使用'__soapCall'?那個僞魔術方法主要用於非wsdl模式的調用。如果你傳遞一個wsdl,客戶端會爲你生成方法__。 –
SoapClient由wsdl2php生成,因此此方法也由wsdl2php生成。 – molleman