TechieGeekster
TechieGeekster

Reputation: 25

Trying to consume a C# web service in VB.NET

I have a web service that was written by another developer here.

The Service itself was written in C#. There are two places in which I am calling it. In my windows VB.NET application, it works great - I can add the reference to the web service and invoke an instance of the class.

However, when I try to do the exact same thing in an ASPX.VB code behind page I find that even though intellisense recognizes the class and the methods, when I try to create an object as a new instance of that class, tells me it is not defined.

For our purposes here I will call the service instance myWebSvc At the top of this service, the public class is named "Service1"

I have added the web reference to the web site, and I get to the point where I try to set it up as such:

Dim objSvc as myWebSvc.Service1 = New myWebSvc.Service1

This causes me to get the following compliation error:

Compiler Error Message: BC30002: Type 'myWebSvc.Service1' is not defined.

I've found some hints that perhaps I need to make a proxy service to call it but I can't seem to get that to function either. The reference is located in App_WebReferences/myWebSvc/ and has a .discomap file as well as a .disco and .wsdl files nested under that.

Upvotes: 2

Views: 1481

Answers (1)

CodeCaster
CodeCaster

Reputation: 151588

The proxy class most likely isn't named myWebSvc.Service1. Look at the generated code (I guess it's Reference.vb in your myWebSvc directory) and remember what name you typed in when you generated it, and you'll discover you need something like:

myWebSvcReference1.Service1Client

Upvotes: 2

Related Questions