【发布时间】:2018-04-09 04:56:56
【问题描述】:
我正在使用 BasicHttpBinding 在 WCF 服务中创建 SOAP 服务(ASMX 服务)。同实现here
编写接口如下
[ServiceContract]
public interface IExample
{
[OperationContract]
[WebMethod]
Task<XmlElement> GetDetails ();
[OperationContract]
[WebInvoke(Method = "Get", UriTemplate = "/GetExample")]
Task<string> GetExample (string guid);
}
接口的实现:
public class ImplementInteface: IExample{
public ImplementInterface(){}
public Task<XmleElement> GetDetails(){
//Implementation of GetDetails function
}
public Task<string> GetExample(string guid){
//Implementation of GetExampl function
}
}
Service Fabric 运行后,无状态服务正常运行。
我有旧代码(asmx 文件),其中已经定义了相同的结构并具有相同的 ATP。暴露遗留 API 的 URL,我不想弄乱它。 我想向同一个 URL 公开新的 SOAP api。 但是,当我尝试从无状态服务调用新的 SOAP API 时,它给了我 Bad request 作为错误。 有什么方法可以将这些 api 创建到 service fabric 中的无状态服务中?
【问题讨论】:
-
这是一个 WCF 服务示例:github.com/loekd/ServiceFabric.WcfCalc
-
"...SOAP 服务(ASMX 服务)到 WCF..." - 好吧,ASMX 服务既不是 SOAP 服务,也不是使用 WCF。 ASMX 服务早于 WCF 和 SOAP
-
@LoekD,我通过将您的代码作为参考来实施我的服务。感谢那。但是,当我尝试运行我的 ATP 来测试特定的 API 时,那些 ATP 失败了,结果给了我错误的请求。我是 SOAP API 的新手。
标签: c# web-services wcf soap azure-service-fabric