Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/275.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 使用soapClient时发生SOAP操作错误_Php_Soap_Wsdl - Fatal编程技术网

Php 使用soapClient时发生SOAP操作错误

Php 使用soapClient时发生SOAP操作错误,php,soap,wsdl,Php,Soap,Wsdl,我在尝试进行soap调用时遇到此错误 The SOAP action specified on the message, '', does not match the HTTP SOAP Action. 当我调用$service->SearchTouristItems($sti)(此函数在下面)我得到了上面的错误,我不知道为什么 下面是我正在使用的代码 //我曾经创建了tcs2服务,它扩展了SoapClient $service = new TCS2Service() ; $sd = ne

我在尝试进行soap调用时遇到此错误

The SOAP action specified on the message, '', does not match the HTTP SOAP Action. 
当我调用
$service->SearchTouristItems($sti)(此函数在下面)我得到了上面的错误,我不知道为什么

下面是我正在使用的代码

//我曾经创建了tcs2服务,它扩展了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' => ''
           )
      );
  }

虽然不确定,但代码中
'soapaction'=>'
的值是多少,将替换为提供的参数。我没有用PHP调用web服务的经验,所以我只是想了想

我认为您的ws-addressing没有打开。请打开ws- 寻址并再次检查。

我会做什么:

  • 检查SOAP操作是否在WSDL中定义良好:查找
    address location=“

  • 尝试另一个WSDL到php转换器

  • 发送WSDL url,以便我可以在我身边尝试


如何打开ws-Addressing请通过此链接查看您的
SoapClient
实例看起来处于wsdl模式…那么,您为什么要使用
\uuuSOAPCall
?该伪魔术方法主要用于非wsdl模式的调用。如果您传递wsdl,客户端将为您生成方法。SoapClient由WSDL2HP,因此此方法也由WSDL2HP生成。
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);
}