implementing an interface in a web service

M

Michael M

I have a DLL that exposes a simple interface:

public interface IBase

function HelloWorld() as String

end interface

I want to implement this interface as web service.

Now, I have successfully IMPLEMENTED the interface using the standard
implements clause such that:

public class MyService
inherits System.Web.Services.WebService
implements IBase

<WebMethod()> _
Public Function HelloWorld() As String Implements IBase.HelloWorld
Return "This method is called from the web service"
End Function
end class

HOWEVER

In the web service consumer cannot correctly identify the interface
being used:

public sub Main()
dim obj as IBase = new MyService ' <--- Throws an error
MsgBox(obj.HelloWorld)
end sub

I modified the Reference.vb file (proxy) that was generated as a
result of adding the web reference, but this would require me to
modify the Reference.vb file EVERY TIME I added the web reference to a
project.

What I would eventually like to do is to use reflection to instantiate
this object (in case I so choose to implement another consumption
method). Am I just missing an attribute?

I have heard of exposing interfaces over web services, but is there a
trade off for trying to do this as opposed to direct implemeting an
assembly interface.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top