Search code examples
vb.netmethodsconsolewebservices-client

Consuming web service from console app


We have a web app that contains web methods. I want to invoke one of those methods from a console app. I am new at this but I wrote a console app, added a service reference and tried to code invoking it.

If my web method is called "Transmit", I expected to see Transmit in the namespace I specified but instead I see "TransmitRequest", "TranmsitRequestBody", "TransmitResponse" and "TransmitResponseBody".

What are these things? Have I done something wrong? How do I invoke the web method in the web app from the console app?

Thank you for all help to this newbie. I am using VB.net 2008.


Solution

  • If you expand the ServiceReference Folder in solutionExplorer, double click on your service and it should open the object explorer. Now you will see the class (the one without the I infront). In your code you will then instantiate a new variable with the [ServiceReferenceName].[ClassName] i.e.

    Dim svc as new ServiceReference1.MyWebService();
    svc.Transmit();