尝试执行.net webservice方法时出现PHP错误

时间:2013-01-24 18:37:44

标签: php soap methods call

我需要与.net(我认为)中的web-service构造进行通信,但是当我尝试调用方法时,返回此错误:

  

在消息上指定的SOAP操作''与HTTP SOAP Action“http://tempuri.org/TripointWebservicesVersionedGeneral/Ping”不匹配。

连接到Web服务和执行方法的代码:

$client = new SoapClient(
                    '...?wsdl',
                        array(
                            'trace' => 1,
                            'soap_version' => SOAP_1_2
                        )
                    );

//$test = $client->__soapCall('Ping',array(''));
$test = $client->Ping();

出现此错误的原因是什么?或者我需要做些什么来调用方法?

我已经阅读了这个PHP Fatal error: "The SOAP action specified on the message, '', does not match the HTTP SOAP Action",并在"'action' => '.../Ping'"添加了肥皂连接选项,但没有帮助我。

2 个答案:

答案 0 :(得分:1)

我找到了为什么我不能调用方法的原因,因为它:

其中一个问题: PHP返回“捕获异常:无法处理消息,因为内容类型'text / xml; charset = utf-8'不是预期类型'application / soap + xml; charset = utf-8'。”

原因: WCF正在运行比PHP预期的Web服务的新版本。

解决方案:

将WCF服务的绑定类型从binding =“wsHttpBinding”更改为binding =“basicHttpBinding”。

这可确保您的.NET Web服务支持符合WS-I标准的客户端和其他服务。

url来源: http://spacebug.com/php-calling-wcf-part-1-html

答案 1 :(得分:0)

不是一个完整的答案,但我只想强调您可能面临此问题,因为您正在使用SoapClient尝试使用使用WS-Addressing的Web服务。您应该尝试追踪其他人在这种情况下的行为:

http://www.cdatazone.org/index.php?/archives/15-WS-Addressing-for-extsoap.html

https://github.com/wso2/wsf