Call a webservice with out using proxy class

Discussion in 'ASP .Net Web Services' started by Madjid Nasiri, Oct 26, 2004.

  1. Hi,
    I need call a webservice without using proxy class, How i can it?

    Thanks for help
    Madjid Nasiri
    Madjid Nasiri, Oct 26, 2004
    #1
    1. Advertising

  2. Madjid Nasiri wrote:
    > I need call a webservice without using proxy class, How i can it?


    Why do you need to do this? I guess, if nothing else, you could just
    craft a properly formatted SOAP message and send it on over to the Web
    service in an HTTP request, but why do all this heavy lifting? Proxy
    classes are designed to simplify this whole process.

    --

    Scott Mitchell

    http://www.4GuysFromRolla.com

    * When you think ASP.NET, think 4GuysFromRolla.com!
    Scott Mitchell [MVP], Oct 26, 2004
    #2
    1. Advertising

  3. Hi Scott and other reader,
    I have to write a program for call any webservice, this program must get
    webservice's wsdl and show a xform for geting parameters and then send
    parameter to webservice and show result.
    How can send a SOAP message to a webservice? I wrote my program in asp.net
    and C#.

    Thanks for help, special scott.

    "Scott Mitchell [MVP]" <> wrote in message
    news:TYzfd.526$...
    > Madjid Nasiri wrote:
    > > I need call a webservice without using proxy class, How i can it?

    >
    > Why do you need to do this? I guess, if nothing else, you could just
    > craft a properly formatted SOAP message and send it on over to the Web
    > service in an HTTP request, but why do all this heavy lifting? Proxy
    > classes are designed to simplify this whole process.
    >
    > --
    >
    > Scott Mitchell
    >
    > http://www.4GuysFromRolla.com
    >
    > * When you think ASP.NET, think 4GuysFromRolla.com!
    Madjid Nasiri, Oct 27, 2004
    #3
  4. Madjid Nasiri wrote:
    > Hi Scott and other reader,
    > I have to write a program for call any webservice, this program must get
    > webservice's wsdl and show a xform for geting parameters and then send
    > parameter to webservice and show result.
    > How can send a SOAP message to a webservice? I wrote my program in asp.net
    > and C#.


    So is the challenge, then, creating the form on the fly? That is, you
    do not know the Web service's WSDL contract prior to when you want to
    call it?


    --

    Scott Mitchell

    http://www.4GuysFromRolla.com

    * When you think ASP.NET, think 4GuysFromRolla.com!


    > Thanks for help, special scott.
    >
    > "Scott Mitchell [MVP]" <> wrote in message
    > news:TYzfd.526$...
    >
    >>Madjid Nasiri wrote:
    >>
    >>>I need call a webservice without using proxy class, How i can it?

    >>
    >>Why do you need to do this? I guess, if nothing else, you could just
    >>craft a properly formatted SOAP message and send it on over to the Web
    >>service in an HTTP request, but why do all this heavy lifting? Proxy
    >>classes are designed to simplify this whole process.
    Scott Mitchell [MVP], Oct 27, 2004
    #4
  5. This may help you get started. A great article from Roman Kiss on
    CodeProject demonstrates programmatically reading WSDL and dynamically
    generating in memory a proxy class that can be used to exercise methods. I
    wrote a short snippet to test it below.

    The key is the ServiceDescription class, at least, it's the starting point.

    ---------------- WebServiceAccessor.cs starts ----------------------------
    Go to Roman's excellent article on The Code Project at:
    http://www.thecodeproject.com/cs/webservices/webservicecallback.asp then
    look for the code snippet titled WebServiceAccessor.
    ---------------- WebServiceAccessor.cs ends ------------------------------

    ---------------- ExeWSDL.cs starts ----------------------------
    using System;
    using System.Diagnostics;
    using System.IO;
    using System.Text;
    using System.Net;

    namespace ExeWSDL
    {
    public class WSDLExecuter
    {
    public static void Main(string [] args)
    {
    WebServiceAccessor ac = new
    WebServiceAccessor("http://www.mccomsoft.com/Test.asmx?wsdl");
    object esObj = ac.CreateInstance("Test");
    //string sProgramArguments = "";
    object retval = ac.Invoke(esObj, "TestResponse", null);
    Console.WriteLine((string) retval);
    }
    }
    }
    ---------------- ExeWSDL.cs ends ------------------------------

    Build with:

    csc -out:ExeWSDL.exe ExeWSDL.cs WebServiceAccessor.cs

    Dilton



    "Madjid Nasiri" <> wrote in message
    news:...
    > Hi Scott and other reader,
    > I have to write a program for call any webservice, this program must get
    > webservice's wsdl and show a xform for geting parameters and then send
    > parameter to webservice and show result.
    > How can send a SOAP message to a webservice? I wrote my program in asp.net
    > and C#.
    >
    > Thanks for help, special scott.
    >
    > "Scott Mitchell [MVP]" <> wrote in message
    > news:TYzfd.526$...
    >> Madjid Nasiri wrote:
    >> > I need call a webservice without using proxy class, How i can it?

    >>
    >> Why do you need to do this? I guess, if nothing else, you could just
    >> craft a properly formatted SOAP message and send it on over to the Web
    >> service in an HTTP request, but why do all this heavy lifting? Proxy
    >> classes are designed to simplify this whole process.
    >>
    >> --
    >>
    >> Scott Mitchell
    >>
    >> http://www.4GuysFromRolla.com
    >>
    >> * When you think ASP.NET, think 4GuysFromRolla.com!

    >
    DM McGowan II, Oct 31, 2004
    #5
  6. Hi McGowan,

    That's working. Very Thanks for answer

    Mad Nas

    "DM McGowan II" <> wrote in message
    news:...
    > This may help you get started. A great article from Roman Kiss on
    > CodeProject demonstrates programmatically reading WSDL and dynamically
    > generating in memory a proxy class that can be used to exercise methods. I
    > wrote a short snippet to test it below.
    >
    > The key is the ServiceDescription class, at least, it's the starting

    point.
    >
    > ---------------- WebServiceAccessor.cs starts ----------------------------
    > Go to Roman's excellent article on The Code Project at:
    > http://www.thecodeproject.com/cs/webservices/webservicecallback.asp then
    > look for the code snippet titled WebServiceAccessor.
    > ---------------- WebServiceAccessor.cs ends ------------------------------
    >
    > ---------------- ExeWSDL.cs starts ----------------------------
    > using System;
    > using System.Diagnostics;
    > using System.IO;
    > using System.Text;
    > using System.Net;
    >
    > namespace ExeWSDL
    > {
    > public class WSDLExecuter
    > {
    > public static void Main(string [] args)
    > {
    > WebServiceAccessor ac = new
    > WebServiceAccessor("http://www.mccomsoft.com/Test.asmx?wsdl");
    > object esObj = ac.CreateInstance("Test");
    > //string sProgramArguments = "";
    > object retval = ac.Invoke(esObj, "TestResponse", null);
    > Console.WriteLine((string) retval);
    > }
    > }
    > }
    > ---------------- ExeWSDL.cs ends ------------------------------
    >
    > Build with:
    >
    > csc -out:ExeWSDL.exe ExeWSDL.cs WebServiceAccessor.cs
    >
    > Dilton
    >
    >
    >
    > "Madjid Nasiri" <> wrote in message
    > news:...
    > > Hi Scott and other reader,
    > > I have to write a program for call any webservice, this program must get
    > > webservice's wsdl and show a xform for geting parameters and then send
    > > parameter to webservice and show result.
    > > How can send a SOAP message to a webservice? I wrote my program in

    asp.net
    > > and C#.
    > >
    > > Thanks for help, special scott.
    > >
    > > "Scott Mitchell [MVP]" <> wrote in message
    > > news:TYzfd.526$...
    > >> Madjid Nasiri wrote:
    > >> > I need call a webservice without using proxy class, How i can it?
    > >>
    > >> Why do you need to do this? I guess, if nothing else, you could just
    > >> craft a properly formatted SOAP message and send it on over to the Web
    > >> service in an HTTP request, but why do all this heavy lifting? Proxy
    > >> classes are designed to simplify this whole process.
    > >>
    > >> --
    > >>
    > >> Scott Mitchell
    > >>
    > >> http://www.4GuysFromRolla.com
    > >>
    > >> * When you think ASP.NET, think 4GuysFromRolla.com!

    > >

    >
    Madjid Nasiri, Nov 21, 2004
    #6
    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. contrex
    Replies:
    5
    Views:
    62,039
    thebigj816
    Jul 23, 2011
  2. Cyril
    Replies:
    2
    Views:
    4,478
    Cyril
    Jun 1, 2006
  3. Replies:
    2
    Views:
    715
  4. SushiSean

    webService call use IE proxy

    SushiSean, Oct 19, 2007, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    161
    SushiSean
    Oct 19, 2007
  5. René Preußler

    Asynchronous Call of WebService method within a WebService

    René Preußler, Oct 29, 2008, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    182
    René Preußler
    Oct 29, 2008
Loading...

Share This Page