0

I am simply looking for an example of an ASP.NET Web Application (in C#) that consumes a published HTTP-GET web service.

Seems like it should be an easy thing to find online, but I have yet to come across one.

2
  • Can't you create one yourself and consume it with another app? Commented Feb 22, 2011 at 18:19
  • The code for the consumer is what I'm looking for. I don't care whether the example accesses an existing service. Commented Feb 22, 2011 at 18:21

1 Answer 1

1

Right-click your project in Visual Studio 2010 and select the option "Add Web-Reference...".

In the "Add Web Reference" dialog, type the URL of the web-service, for example http://www.startvbdotnet.com/web/sample2.asmx, and a "Web reference name", for example "com.startvbdotnet.www".

A lot of code will be generated on your project. The "Web reference name" will be the name of the generated namespace.
The classes of that namespace will work like "normal" classes, but behind the scenes the method calls will be web-service calls.

com.startvbdotnet.www.Sample teste = new com.startvbdotnet.www.Sample();
int result = teste.Add(1, 2);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.