相关疑难解决方法(0)

PHP致命错误:"在消息上指定的SOAP操作''与HTTP SOAP Action不匹配"

我正在尝试编写一个PHP脚本,它将连接到SightMax接口的SOAP客户端.使用下面的代码,我能够打印出可用的函数列表,但是当我尝试调用任何函数时,我收到以下错误.

<?php

$client = new SoapClient('http://domain.com/SightMaxWebServices/SightMaxWebService.svc?wsdl', array('soap_version' => SOAP_1_2));

var_dump($client->__getFunctions());

$result = $client->__call("GetSiteSummary", array());

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

?>
Run Code Online (Sandbox Code Playgroud)
Fatal error: Uncaught SoapFault exception: [s:Sender] The SOAP action specified on the message, '', does not match the HTTP SOAP Action, 'SmartMax.SightMax.Agent.Operator/IRemotedWebsiteAdministrator/GetSiteSummary'. in test2.php:7 Stack trace: #0 test2.php(7): SoapClient->__call('GetSiteSummary', Array) #1 {main} thrown in test2.php on line 7 
Run Code Online (Sandbox Code Playgroud)

我在过去几天一直在研究这个错误,我读过不同的文章,说明可能的问题.根据我的理解,发生此错误是因为SOAP客户端配置为wsHttpBinding,并且PHP的SOAP客户端中的构建不支持wsHttpBinding,或者我需要专门指定SOAP操作.

谁能为我解释这个问题?请记住,当我精通PHP时,使用SOAP对我来说是新的,所以一步一步非常有帮助.

提前致谢.

php soap

5
推荐指数
2
解决办法
1万
查看次数

由于EndpointDispatcher上的AddressFilter不匹配,无法在接收方处理带有To'...'的消息

我正在尝试实现WCF Rest服务而不修改App.config文件.

我的服务界面如下所示:

[ServiceContract]
public interface IService
{
    [OperationContract]
    [WebInvoke(Method = "POST",
        ResponseFormat = WebMessageFormat.Json,
        RequestFormat = WebMessageFormat.Json,
        BodyStyle = WebMessageBodyStyle.Bare,
        UriTemplate = "/teststr/?string={aStr}")]
    string TestString(string aStr);
}
Run Code Online (Sandbox Code Playgroud)

服务实现非常基础:

public class TestService : IService
{
    public string TestString(string aStr = null)
    {
        Console.WriteLine("The Test() method was called at {0}"
            + "\n\rThe given string was {1}\n\r"
            , DateTime.Now.ToString("H:mm:ss")
            , aStr);

        return aStr;
    }
}
Run Code Online (Sandbox Code Playgroud)

我的主要程序运行一切:

// Step 1 Create a URI to serve as the base address.
Uri baseAddress …
Run Code Online (Sandbox Code Playgroud)

c# rest wcf

4
推荐指数
1
解决办法
8570
查看次数

标签 统计

c# ×1

php ×1

rest ×1

soap ×1

wcf ×1