views:

103

answers:

2

I want to call an external webservice. How do I do this in an asp.net mvc program? What options do I have. Does anyone have an example?

Thanks.

A: 

check out this article if you're calling your web service client side using jQuery.

It's done with JSON, but you could get XML by changing the dataType parameter to dataType: "xml" or not including it all as it is the default.

If you're doing it server side check out this article. It's VB.Net but you can easily translate it to C#

I hope this helps.

hunter
Yes I am looking for an mvc solution.
Joe
A: 

You call an external webservice in an ASP.NET MVC application the same way you call it in any .NET application. If it is a SOAP based service you generate a proxy class using svcutil.exe, if the service uses some proprietary XML you may need to resort to HttpWebRequest.

Darin Dimitrov