• Creating a webservice client on Visual Studio 2008

    Posted on April 25th, 2010 admin No comments

    Hello guys,

    I will show here how to create a web service client on Visual Studio 2008, you will see how easy can be that.

    1. Right-click on your project and go to add web reference.

    Add web reference

    2. After that you need to insert the url of the web service and then the windows normal steps, next, next, finish. In my case i am connecting to a webservice running on my own machine.

    Insert webservice url

    3. You will note that if everythings go fine, VS 2008 will create the source files ready to use.

    Code generated

    4. Here is a sample code about how to use your webservice client inside your application code.

    localhost::NetunoWSService ws;
    System::String^ res = "WS NOT AVAILABLE";

    try
    {
    res = ws.sendData(this->email,this->password,this->hostname,data);
    }
    catch (System::Exception^ ex)
    {
    //res = ex->ToString();
    res = “Web Service is not available or your internet is down”;
    }

    5. If you change something on your webservice server application you will need to reload the web references.

    Enjoy! Any questions i am open for discussions!