添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

Can anybody explain to me what the following code does? Specifically, the attribute on the GetStatus method. I know it has something to do with SOAP requests, but I tried googling "SoapDocumentMethodAttribute" and didn't find much that explains things. Can anybody dumb it down for me please?

[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]));

Soap services expose WSDL to the consumers which contain information about how SOAP messages would be written.

This WSDL can be written either in RPC style or in Document Style.

Document style is perfered over RPC style as it means less coupling and provides better way to validate the message.

This attribute instructs WSDL generator to use Document Style.

From the MSDN Documentation:

Web Services Description Language (WSDL) defines two styles for how an XML Web service method, which it calls an operation, can be formatted in a SOAP message: RPC and Document. Document refers to formatting the XML Web service method according to an XSD schema. The Document style refers to formatting the Body element as a series of one or more message parts following the Body element.

Refer this link for examples of RPC / Document style.

First parameter is to set the Action header in soap message. This is generally used to identify the method which should be invoked after receiving soap message. – Manoj Choudhari Jan 28, 2019 at 15:57 Second and Third parameter specify the xml namespaces for request soap message and response soap message. – Manoj Choudhari Jan 28, 2019 at 15:57

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.