Access web service through code without Visual Studio project

Posted on 2009-04-24
Last Modified: 2013-11-19
Hi, I need to be able to access a web service through code in C#. I am unable to use the Visual Studio wizard to reference the web service with the third party app that I'm using. Can anyone tell me how to do so directly in C#. I am given the address to the asmx file but I don't know what to do from there.
Question by:dynamk
    LVL 12

    Expert Comment

    You can use disco.exe to create a WSDL file

    and then use WSDL.exe to create the classes for your code

    Author Comment

    These articles are very good. For someone who is not very experienced can an example be provided as to how to programmatically access a web service through code?
    LVL 12

    Accepted Solution

    using the web service as an example

    1) I opened up the command prompt via VS 2008 tools
    2) I created a directory on my system "C:\disco"
    3) I ran the discovery command

    C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC>disco /o:c:\disco

    4)  I then ran the wsdl compiler

    C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC>wsdl.exe /l:CS /o:C:\DISCO c:\disco\CurrencyConvertor.wsdl

    5) I now have a file ('C:\DISCO\CurrencyConvertor.cs) that I can include in my project

    6) After adding to my project I create a service proxy and issue a command, using that web service I am asking for a conversion rate between US dollars and the British pound

            CurrencyConvertor c = new CurrencyConvertor();
            double cnv = c.ConversionRate(Currency.USD, Currency.GBP);

    Author Closing Comment


    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Join & Write a Comment

    Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
    Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now