Interface of managed Windows Service published as WebService ?

Discussion in 'ASP .Net Web Services' started by Josef Fa, Sep 30, 2003.

  1. Josef Fa

    Josef Fa Guest

    Hi all,

    I have a WebService - WindowsService architectural question.
    Given a managed windows service, written in C#, and running independently
    of IIS as a windows service. I want to publish an open interface as a web
    service. The methods of the open interface have a lot parameters / return
    values of complex data types.

    What is the simples solution to do this ?

    One possible ( but propably not the easiest) solution is to implement an
    ASP.NET webservice. This webservice calls over .NET remoting the managed
    windows service object (singleton) over a companion remoted interface, like
    this:

    ASP.NET Project foo.asmx.cs :

    [WebService]
    public class MyService : System.Web.Services.WebService
    {
    static public IMyRemotingService server = Activator.GetObject(...);

    [WebMethod]
    public ComplexData1 Foo([XmlAttribute] ComplexData2[] p1, out
    ComplexData3 p2)
    {
    RemoteComplexData1 result;
    RemoteComplexData2[] rp1 = Convert.ToRemote(p1);
    RemoteComplexData3 rp2;

    result = server.Foo(rp1, out rp2);

    p2 = Convert.FromRemote(rp2);
    return Convert.From(result);
    }
    ...
    }

    public class ComplexData1
    {
    ....
    }
    ....


    Windows Service Project server.cs:

    public interface IMyRemotingService
    {
    RemoteComplexData1 Foo(RemoteComplexData2 p1, out RemoteComplexData3
    p2);
    }

    [Serializable]
    public class RemoteComplexData1
    {
    ....
    }

    public class MyRemotingService : MarshalByObjRef, IMyRemotingService
    {
    public RemoteComplexData1 Foo(RemoteComplexData2 p1, out
    RemoteComplexData3 p2)
    {
    ...
    }
    }


    Is there a better solution without defining the whole interface and the
    parameter classes twice (webservice and serializable) and write a wrapper ?

    Is there a direct way to publish an interface running in an independent
    windows service as a real webservice (as recommended under IIS/ASP.NET)?

    thanks for any suggestion,
    Josef
     
    Josef Fa, Sep 30, 2003
    #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. Replies:
    0
    Views:
    376
  2. Jon Martin Solaas

    EJB published as web service

    Jon Martin Solaas, Jul 27, 2006, in forum: Java
    Replies:
    1
    Views:
    384
  3. Brent White
    Replies:
    3
    Views:
    435
    Brent White
    Nov 1, 2007
  4. DNB
    Replies:
    1
    Views:
    261
  5. DNB
    Replies:
    1
    Views:
    313
    John Saunders [MVP]
    Jan 20, 2008
Loading...

Share This Page