Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reference a Web Service from an ASP.NET MVC project?

I want to add a web service to my ASP.NET MVC 5 project.

I do that by right click on the project in solution explorer > add > service reference.

Then I add a web service url like this and it creates a new file in Service References folder called ServiceReference1

Then I'm able to call web service methods in C# by using ServiceReference1 namespace and VS intellisense works.

The problem is that when I add this web service url, it adds a new namespace (ServiceReference2) to that folder, but I can't call the new namespace and it says ServiceReference2 namespace could not be found.

Is it me doing something wrong or the web service has a problem?

like image 235
user4641936 Avatar asked Mar 06 '15 20:03

user4641936


Video Answer


1 Answers

After you open your service window, click on the advanced button like below.

In general, I agree it's best not to use the older versions of web-services like I'm showing here, but in real life people have deadlines and such.

Saying that though, there is no huge drawback to using this tech, as long as performance isn't an issue.

enter image description here

Then, click 'add Web Reference' like the picture below.

enter image description here

Then enter URL and click on the little arrow button. Name your reference and click 'Add Reference'. see pic below

enter image description here

like image 94
sam starobin Avatar answered Oct 26 '22 06:10

sam starobin