views:

278

answers:

2

I have created a web service in a virtual directory using VS 2008. I have tested the service by going to the .asmx page and everything is working fine. So I selected the "Add web reference" option under the solution and typed in the .asmx URL. It found the web service successfully and added the reference to the project. However, when I try to import the service namespace using the same name as the directory under the "App_WebReferences" folder, it doesn't recognize the name and gives me an error if I try to import it. Have I missed any steps in the process?

A: 

To be absolutely certain click view all files in you web project and follow your reference in App_WebReferences down until you get to reference.cs open this and you can see the correct namespace.

Gary
I drilled down, but could not find a reference.cs file...by the way, I'm working in VB.NET. The only files I found were the following: Service.disco, Service.discomap, and Service.wsdl.
Brian Lewis
Try this <project namespace>.<web reference name>Imports ClassLibrary1.ServiceReference1Public Class Class1End Class
Gary
+2  A: 

Update: Try generating the proxy manually using the wsdl tool and adding the proxy class as an existing item to client web application project as mentioned in the link.

Something strange happening with proxy generation in your case from VS. Maybe an access issue. If it happened fine, you should be able to find the VS generated proxy class under one of the sub-folders of %windir%\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\ (for Asp.Net 2.0). Search for file names starting with App_WebReferences*.cs in the temporary folder.


When you added the web service, what is the name of the web reference you gave? Use the same web reference name in your import statement.

In this link, web reference name is com.deepfitness so you can import com.deepfitness namespace in your asp.net app.

Gulzar
Just to see if it was a problem with my web service, I added the deepfitness service (using "com.deepfitness") to my web references. Then I created a new page and tried importing it, but it couldn't find that namespace and wouldn't let me import it.
Brian Lewis