Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > .NET Web Services
|
.NET Web Services Discussions about .NET XML Web Service technologies including ASMX files, WSDL and SOAP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Web Services section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 13th, 2006, 10:35 AM
Registered User
 
Join Date: Nov 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to consume a web service

Help Help Help.

This will be an easy question for you veteran .Net developers.

Here goes.

I created a simple web service to add 2 numbers on machine A.
I compiled it to create the .asmx file.
In Visual studio 2.0 I did a "View in Browser and the service works great.

I then created a windows app to call the web service on machine A.
I created a web reference to the service from the windows app.
I called the web service and it worked perfectly by instantiating the service to consume it.

I then tried to create the same windows forms application on machine B.
I can't get the windows application to see the web service on machine A even if I try to reference it using the ip address of machine A.

Any Ideas.

I've checked 6 .Net books and still not have found this to work.

Thanks

Jim

 
Old November 13th, 2006, 01:33 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Are you using the built-in Developer Webserver? If so, this won't won't work as it will only listen to requests from the local machine.

You'll need to deploy your webservice to IIS so it's viewable by other machines as well.


Imar
 
Old November 13th, 2006, 01:37 PM
Registered User
 
Join Date: Nov 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Imar,

I think I'm using IIS. I created the service in c:\inetpub\wwwroot\myservice.

Is there anything else I have to do ?

I'm not sure what the built-in developer webserver is ?

Thanks

Jim

 
Old November 13th, 2006, 01:49 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

The built-in web server is what you get by default when you hit F5 on a ASP.NET 2 project in Visual Studio. It's designed to make it much easier for developers to develop and debug websites on a local development machine.

When you run the site locally, what's the address you use? Just http://localhost/ServiceName.asmx or something like http://localhost:3456/SiteName/ServiceName.asmx?

Cheers,

Imar
 
Old November 13th, 2006, 03:29 PM
Registered User
 
Join Date: Nov 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Imar,

One thing that is interesting (I don't know if it is relevant) is the following:

http://localhost:1531/Service1/service.asmx works but

http://10.192.96.203:1531/Service1/service.asmx does not work.

(Where 10.102.96.203 is the ip address of the machine which has the service)

Is this a permissions problem ?

Thanks

Jim


 
Old November 14th, 2006, 04:34 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

The built-in webserver, which you are using judging from the port number, only listens to requests for the localhost. That's why the IP number doesn't work.

You need to install it under IS.

Cheers,

Imar
 
Old November 14th, 2006, 09:45 AM
Registered User
 
Join Date: Nov 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

That makes perfect sense. Though, doesn't my website get setup with IIS automatically when I do a build. I already put the webservice in c:\inetpub\wwwroot ?

Thanks

Jim

 
Old November 14th, 2006, 11:08 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

No it doesn't. Like I said, you get the built-in webserver by default. Where you put the site doesn't really matter.

So, make sure that IIS is pointing to the same folder (it probably does when you saved it in C:\inetpub\wwwroot) and then tell VS 2005 to use localhost instead of starting the built-in web server. To do this, choose Website | Start Options and then under Server choose Use custom server and point it to http://localhost.

Now when you run or debug the page, you'll do so against IIS and others in your network can access the site / service as well.

Imar





Similar Threads
Thread Thread Starter Forum Replies Last Post
consume a webservice mj1223 Classic ASP XML 2 July 9th, 2008 04:21 PM
Web Service Consuming another web service CraigWhitfield EJB 0 January 10th, 2008 08:38 AM
Error to Add Web Reference from a Web service jdjbarrios ASP.NET 2.0 Professional 0 July 18th, 2006 02:58 PM
Service Oriented Web Service aldwinenriquez .NET Web Services 2 September 15th, 2005 03:25 AM
Consume a Web Service from Classic ASP pranoliver Classic ASP Professional 1 February 25th, 2004 10:56 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.