簡體   English   中英

使用soapClient時的SOAP操作錯誤

[英]SOAP action error when using soapClient

我在嘗試撥打電話時收到此錯誤。

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

當我調用$service->SearchTouristItems($sti); (此功能在下面)我得到了上面的錯誤,我也不知道為什么。

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

//我使用http://www.urdalen.no/wsdl2php/創建了擴展SoapClient的TCS2Service

$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' => ''
           )
      );
  }

這是客戶端的初始化

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);
}

不確定,但是代碼中'soapaction' => ''的值被替換為提供的參數。 我沒有用PHP調用Web服務的經驗,所以給了一個想法。

我認為您的ws尋址未打開。 請打開ws尋址,然后再次檢查。

我會怎么做:

  • 檢查WSDL中是否正確定義了SOAP操作:查找address location="

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

  • 發送WSDL網址,以便我可以在我身邊嘗試

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM