PDA

Click to See Complete Forum and Search --> : Problem in add web reference


Terence
Apr 29th, 2002, 12:47 AM
I am using the official release of Visual Studio on W2K. When I was exploring with the web service, I failed to add web reference to a web form. What I have done are:
(1) Create a very simple web service and build it. I was able to use it via http://localhost/WebService1/Service1.asmx
(2) Close this solution.
(3) Open a new project for a new web form
(4) add web reference by selecting this option on the project tool submenu.
(5) On the "add web reference" window, I could only see the two UDDI items but I could not find the "web reference on local web server"
(6) I explicitely typed in http://localhost/webservice1/Service1.asmx on the address box and were able to get to the HTML view of this web service interface. Then I pressed the add web reference button to add it and the solution explorer showed a web reference folder added.
(7) But when I add code to reference to the service in the web form, the Intellisense could not find the web service.

Could anyone tell me what I have done wrongly ?

Shawn N
Apr 29th, 2002, 03:41 AM
Have you tried writing coding against the web service? Just because VS doesn't pick it up doesn't mean it you can't.

weijian
Apr 29th, 2002, 04:00 PM
Hmmm that is pretty fuzzy. I always though you can only add a web reference if everything is under the same solution. But from what I understand from your post, you have two solutions, one with the web form and the other with the web control?

Terence
Apr 29th, 2002, 09:54 PM
Thanks for your reply. I did try to write code to use the web service. What I wrote was :

dim objService as new WebService1.Service1
intX = objService.Add(intA, intB)

where Add is the simple web service being tested.

The function was not resolved and failed during execution.

Yes, I did call the web service from web form of another solution. However, I tried to use it in the same solution as suggested but the result was the same.

I think web services should be able to be used no matter in which solution it is, as long as the SOAP contract can be obtained.

Now it seemed that the add web reference wizard in Visual Studio did not work.

programatix
Apr 30th, 2002, 01:43 AM
It should be localhost.Service1

Please refer to the Solution Explorer. Expand the Web Reference node. You should see something like this (if you haven't rename anything yet)


+ Web Reference
+ localhost (*)
+ Service1.wsdl
+ Reference.map


Note:
(*) You can rename "localhost" to anything you want. For example, you can rename it to "WebService". In this case you refer your web service like this, "Webservice.Service1". You can also rename it to "MyProject.KillerService". Now you refer to your service like this, "MyProject.KillerService.Service1".

So, if you have more than one Web Service, you could name them like this,


+ Web Reference
+ MyService.Killer
+ Service1.wsdl
+ Reference.map
+ MyService.Eraser
+ Service2.wsdl
+ Reference.map
+ MyService.Cleanser
+ Service3.wsdl
+ Reference.map


Hope this help.

Terence
May 1st, 2002, 09:36 AM
Hi, programatix,

Thank you.

Your suggestion worked! I added the "localhost" in front for it to resolve the reference and the web service method was found.

programatix
May 1st, 2002, 12:08 PM
You're most welcome. :)