Visual Studio WebMethod with specific SOAP format

Discussion in 'ASP .Net Web Services' started by titogarcia@gmail.com, Feb 22, 2007.

  1. Guest

    Hi experts,

    I need a Web Service with a specific SOAP format. Its SOAP request
    and
    response parameters must be XML elements with no nesting, for
    example:


    <soap:Body>
    <MyMethod xmlns="http://tempuri.org/">
    <input1>input1</input1>
    <input2>input2</input2>
    </MyMethod>
    </soap:Body>


    However, using Visual Studio 2005, I cannot see a way to build a Web
    Service like that. I put for instance:


    [WebMethod]
    public Object MyMethod(Object input1, Object input2) {
    Object output = new Object();
    output.my_string = "Hello World";
    return output;
    }


    public class Object
    {
    public string my_string;
    }


    But this builds a Web Service with nested elements inside the
    request:
    <soap:Body>
    <MyMethod xmlns="http://tempuri.org/">
    <input1>
    <my_string>string</my_string>
    </input1>
    <input2>
    <my_string>string</my_string>
    </input2>
    </MyMethod>
    </soap:Body>


    and inside the response:


    <soap:Body>
    <MyMethodResponse xmlns="http://tempuri.org/">
    <MyMethodResult>
    <my_string>string</my_string>
    </MyMethodResult>
    </MyMethodResponse>
    </soap:Body>


    Do you know how can I get this done with Visual Studio?


    Thank you in advance and regards,
    Tito
     
    , Feb 22, 2007
    #1
    1. Advertising

  2. You could use wsdl.exe in order to generate the class and service.

    <> wrote in message
    news:...
    > Hi experts,
    >
    > I need a Web Service with a specific SOAP format. Its SOAP request
    > and
    > response parameters must be XML elements with no nesting, for
    > example:
    >
    >
    > <soap:Body>
    > <MyMethod xmlns="http://tempuri.org/">
    > <input1>input1</input1>
    > <input2>input2</input2>
    > </MyMethod>
    > </soap:Body>
    >
    >
    > However, using Visual Studio 2005, I cannot see a way to build a Web
    > Service like that. I put for instance:
    >
    >
    > [WebMethod]
    > public Object MyMethod(Object input1, Object input2) {
    > Object output = new Object();
    > output.my_string = "Hello World";
    > return output;
    > }
    >
    >
    > public class Object
    > {
    > public string my_string;
    > }
    >
    >
    > But this builds a Web Service with nested elements inside the
    > request:
    > <soap:Body>
    > <MyMethod xmlns="http://tempuri.org/">
    > <input1>
    > <my_string>string</my_string>
    > </input1>
    > <input2>
    > <my_string>string</my_string>
    > </input2>
    > </MyMethod>
    > </soap:Body>
    >
    >
    > and inside the response:
    >
    >
    > <soap:Body>
    > <MyMethodResponse xmlns="http://tempuri.org/">
    > <MyMethodResult>
    > <my_string>string</my_string>
    > </MyMethodResult>
    > </MyMethodResponse>
    > </soap:Body>
    >
    >
    > Do you know how can I get this done with Visual Studio?
    >
    >
    > Thank you in advance and regards,
    > Tito
    >
     
    Mariano Omar Rodriguez, Feb 23, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. wh
    Replies:
    2
    Views:
    574
    Cowboy \(Gregory A. Beamer\)
    Jan 16, 2004
  2. Thirumalai
    Replies:
    0
    Views:
    728
    Thirumalai
    May 22, 2006
  3. rockdale
    Replies:
    1
    Views:
    672
    Juan T. Llibre
    Aug 23, 2006
  4. xman
    Replies:
    0
    Views:
    550
  5. xman
    Replies:
    1
    Views:
    645
    Victor Bazarov
    Aug 17, 2005
Loading...

Share This Page