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. Advertisements

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. =?Utf-8?B?V2ViTWF0cml4?=

    Implementing subscription based Web Service

    =?Utf-8?B?V2ViTWF0cml4?=, Dec 21, 2005, in forum: ASP .Net
    Replies:
    6
    Views:
    515
    =?Utf-8?B?V2ViTWF0cml4?=
    Dec 22, 2005
  2. hocho888
    Replies:
    1
    Views:
    871
  3. Michael Averstegge
    Replies:
    0
    Views:
    4,547
    Michael Averstegge
    Jan 10, 2006
  4. Not Me
    Replies:
    1
    Views:
    3,469
    Not Me
    Jun 5, 2007
  5. Isaias Formacio Serna

    Web Service that calls an external Web Service

    Isaias Formacio Serna, Jan 28, 2004, in forum: ASP .Net Security
    Replies:
    5
    Views:
    463
  6. Replies:
    1
    Views:
    400
    Joe Kaplan \(MVP - ADSI\)
    Jun 14, 2006
  7. dgleeson422111

    Consuming local web service - ok, remote web service -problem?

    dgleeson422111, Jan 26, 2010, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    1,084
    dgleeson422111
    Jan 26, 2010
  8. Leo Violette
    Replies:
    0
    Views:
    1,302
    Leo Violette
    Apr 17, 2009
Loading...