implementing an interface in a web service

Discussion in 'ASP .Net Web Services' started by Michael M, Jun 11, 2004.

  1. Michael M

    Michael M Guest

    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.
     
    Michael M, Jun 11, 2004
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Gomathi

    Implementing Interface

    Gomathi, Nov 17, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    574
    S.M. Altaf [MVP]
    Nov 17, 2005
  2. =?Utf-8?B?V2ViTWF0cml4?=

    Implementing subscription based Web Service

    =?Utf-8?B?V2ViTWF0cml4?=, Dec 21, 2005, in forum: ASP .Net
    Replies:
    6
    Views:
    433
    =?Utf-8?B?V2ViTWF0cml4?=
    Dec 22, 2005
  3. Manavendra Gupta
    Replies:
    1
    Views:
    374
    Manavendra Gupta
    Mar 7, 2004
  4. Robert Maas, see http://tinyurl.com/uh3t

    Trouble implementing an interface, strange compiler error

    Robert Maas, see http://tinyurl.com/uh3t, May 15, 2005, in forum: Java
    Replies:
    4
    Views:
    527
    Ross Bamford
    May 15, 2005
  5. Leo Violette
    Replies:
    0
    Views:
    1,107
    Leo Violette
    Apr 17, 2009
Loading...

Share This Page