谁能告诉我SoapDocumentMethodAttribute做什么?

时间:2019-01-28 15:36:34

标签: c# asp.net

有人可以向我解释以下代码的作用吗?具体来说,是GetStatus方法的属性。我知道它与SOAP请求有关,但是我尝试使用Google搜索“ SoapDocumentMethodAttribute”,但发现的内容不足以说明问题。有人可以为我哑巴吗?

[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://dummyurl.com/", RequestNamespace = "http://dummyurl.com/", ResponseNamespace = "http://dummyurl.com/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
    public string GetStatus(string Username, string Password, string EndSystemUser) {
        object[] results = this.Invoke("GetStatus", new object[] {
                    Username,
                    Password,
                    EndSystemUser});
        return ((string)(results[0]));
    }

1 个答案:

答案 0 :(得分:1)

Soap服务向WSDL提供给使用者,该使用者包含有关如何编写SOAP消息的信息。

此WSDL可以以 RPC 样式或 Document 样式编写。

文档样式优于RPC样式,因为它意味着较少的耦合,并提供了更好的方法来验证消息。

此属性指示WSDL生成器使用文档样式

MSDN Documentation:

  

Web服务描述语言(WSDL)定义了两种样式   可以格式化XML Web服务方法(称为操作)   在SOAP消息中:RPC和Document。文档是指格式化   根据XSD架构的XML Web服务方法。文件样式   是指将Body元素格式化为一系列一个或多个   邮件部分紧跟在Body元素之后。

请参考this link,以获取RPC /文档样式的示例。