locked
Can Anyone Explain me what is difference between Soap Formatting option Style and Use & What is soap Body Formatting Option Rpc and document. RRS feed

  • Question

  • User-438408541 posted

    Can Anyone Explain me what is difference between Soap Formatting option Style and Use & What is soap Body Formatting Option Rpc and document.

    Wednesday, March 13, 2013 12:35 PM

Answers

  • User281315223 posted

    As you mentioned there are two major options of formatting your SOAP messages, Style and Use, I'll lightly cover each of them :

    • Style - This pertains primarily to the actual body of your SOAP message (and it's children) and how these elements (otherwise known as your message) are formatted. Styles can be broken down into two options : RPC and Document.
    • Use - This handles how the parameters, return values and a few other elements relating to your SOAP messages are formatted (such as Encoding etc.) Use can be formatted using two options as well : Encoded and Literal.

    So further breaking this down, you can see what each of the individual formatting options does : 

    • RPC - This indicates that the message parameters will be placed within an element that is a sibling of the body of the message, which will be named based on the name of the Service.
    • Document - This specifies that the message will basically be formatted as that of an XML Document based on a schema. It is indifferent to any parameters or return values and it is the developers responsibility to handle how these are accessed.
    • Encoded - This use option formats the according to a specific scheme in the SOAP Specification.
    • Literal - This option formats according to the XML schema of the imported WDSL document related to the service.

    Given this, there are basically four differnent possibilities of formatting a SOAP message :

    • RPC / Encoded
    • Document / Encoded
    • RPC / Literal
    • Document / Literal

    You can find a detailed breakdown of each of these style attributes within the SOAP MDSN Documentation available here.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, March 13, 2013 4:19 PM

All replies

  • User281315223 posted

    As you mentioned there are two major options of formatting your SOAP messages, Style and Use, I'll lightly cover each of them :

    • Style - This pertains primarily to the actual body of your SOAP message (and it's children) and how these elements (otherwise known as your message) are formatted. Styles can be broken down into two options : RPC and Document.
    • Use - This handles how the parameters, return values and a few other elements relating to your SOAP messages are formatted (such as Encoding etc.) Use can be formatted using two options as well : Encoded and Literal.

    So further breaking this down, you can see what each of the individual formatting options does : 

    • RPC - This indicates that the message parameters will be placed within an element that is a sibling of the body of the message, which will be named based on the name of the Service.
    • Document - This specifies that the message will basically be formatted as that of an XML Document based on a schema. It is indifferent to any parameters or return values and it is the developers responsibility to handle how these are accessed.
    • Encoded - This use option formats the according to a specific scheme in the SOAP Specification.
    • Literal - This option formats according to the XML schema of the imported WDSL document related to the service.

    Given this, there are basically four differnent possibilities of formatting a SOAP message :

    • RPC / Encoded
    • Document / Encoded
    • RPC / Literal
    • Document / Literal

    You can find a detailed breakdown of each of these style attributes within the SOAP MDSN Documentation available here.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, March 13, 2013 4:19 PM
  • User-438408541 posted

    Thanks You very Nice answer...

    Its now clear ...

    Can u explain me how to call a web method using soap??

    I know few steps 

    1.Create  a web service.

    2.call a web service using WebRequest class.

    WebRequest request=WebRequest.Create("http:\\localhost/helloworld/service.asmx");

    request.Header.Add("SoapAction","http://tempuri.org/helloworld");

    request.Method="POST";

    request.ContentType="text/xml;charset=\"utf-8\";";

    Stream requestStream=request.GetRequestSream();

    3.Add in main method soap message

    StringBuilder SoapMessage = new StringBuilder();
    SoapMessage.Append("<?xml version='1.0' encoding='utf-8'?>");
    SoapMessage.Append(@"<soap12:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'");
    SoapMessage.Append(@" xmlns:xsd='http://www.w3.org/2001/XMLSchema'>");
    SoapMessage.Append(@" xmlns:soap12='http://www.w3.org/2003/05/soap-envelope'");
    //SoapMessage.Append(@" xmlns:soap12='http://schemas.xmlsoap.org/wsdl/soap12/'");
    SoapMessage.Append("<soap12:Body>");
    SoapMessage.Append("<");
    SoapMessage.Append(method);
    SoapMessage.Append(@" xmlns='http://tempurl.org/'>");

    SoapMessage.Append("</soap12:Body>");

    SoapMessage.Append("</soap12:Envelope>");

    StreamWriter writer=new StreamWriter(requestStream,encoding.UTF8);

    writer.Write(SoapMessage.ToString());

    writer.Close();

    4.process the response with webreposne.

    I dont understand logic and why is there is need to do this .

    please help  me I will be very greatful to u 

     

    Thursday, March 14, 2013 1:06 AM
  • User-438408541 posted

    I am not getting RPC Style formatting...clear

    Soap Request:The elemet below the soap Body element is named after a wsdl operation elemet,which correspond to web service method

    Thursday, March 14, 2013 2:19 AM