Expose method of class returned by web service

Discussion in 'ASP .Net Web Services' started by Toby Mathews, Oct 28, 2003.

  1. Toby Mathews

    Toby Mathews Guest

    Hi there,

    Could anyone tell me if it is possible to expose the methods of a class
    returned by a web service. I have an instance of a class created something
    like this:

    MyWebService webSrv = new MyWebService();

    MyWebService.MyClass myClass = webSrv.GetClass();

    The definition for MyClass in my web service includes some methods, say
    MyClass.Method(), but these aren't visible from the client consuming the web
    service.

    Any help much appreciated, thanks,

    Toby Mathews
     
    Toby Mathews, Oct 28, 2003
    #1
    1. Advertising

  2. The class has to be known to the client. There must be an implementation of
    the class on the client side, in the form of a DLL. It should be the same
    impl as used on the server side. ie: it should be in a shared dLL.

    You need to
    1. use targetNameSpace attribute on the type you want to share across client
    and server. compile this into a DLL - you need to deploy this on both
    client and server.
    2. when you "Add Web Reference" or generate the proxy with wsdl.exe, you
    need to remove the generated types from the source code. Replace references
    to the generated type(s) with the common type(s) from the DLL in step 1.
    Each time you update the WSDL and re-generate the proxy, you have to do this
    manual edit step.
    3. compile the client and server, referencing the common DLL.

    Here's an old blog entry on tihs:
    http://hoppersoft.com/Andy/commentview.aspx?guid=ABAF08B3-1ABD-4DAE-BE05-23B733FF3C5D

    and a sort-of related KB article
    http://support.microsoft.com/default.aspx?scid=kb;en-us;326790


    -Dino

    --
    Dino Chiesa
    Microsoft Developer Division
    d i n o c h @ o n l i n e . m i c r o s o f t . c o m


    "Toby Mathews" <> wrote in message
    news:%...
    > Hi there,
    >
    > Could anyone tell me if it is possible to expose the methods of a class
    > returned by a web service. I have an instance of a class created something
    > like this:
    >
    > MyWebService webSrv = new MyWebService();
    >
    > MyWebService.MyClass myClass = webSrv.GetClass();
    >
    > The definition for MyClass in my web service includes some methods, say
    > MyClass.Method(), but these aren't visible from the client consuming the

    web
    > service.
    >
    > Any help much appreciated, thanks,
    >
    > Toby Mathews
    >
    >
     
    Dino Chiesa [Microsoft], Oct 28, 2003
    #2
    1. Advertising

  3. Toby Mathews

    Mohan Guest

    Hi,
    What you're trying to achieve is workable; but the best
    practise is not to have business functionality in the
    object that you're receiving, rather it has to be a
    container.
    These will avoid having the proxy class as dll and client
    just access the web services and make use of it
    immediately rather than waiting for the dll.
    Have a look at this it might help you.
    http://msdn.microsoft.com/msdnmag/issues/02/12/WebServicesD
    esign/

    >-----Original Message-----
    >Hi there,
    >
    > Could anyone tell me if it is possible to expose the

    methods of a class
    >returned by a web service. I have an instance of a class

    created something
    >like this:
    >
    >MyWebService webSrv = new MyWebService();
    >
    >MyWebService.MyClass myClass = webSrv.GetClass();
    >
    > The definition for MyClass in my web service includes

    some methods, say
    >MyClass.Method(), but these aren't visible from the

    client consuming the web
    >service.
    >
    > Any help much appreciated, thanks,
    >
    >Toby Mathews
    >
    >
    >.
    >
     
    Mohan, Nov 4, 2003
    #3
    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. C
    Replies:
    1
    Views:
    382
    Steve C. Orr, MCSD
    Jul 30, 2003
  2. Paul Russell

    HtmlControls doesn't expose GridLayoudPanel?

    Paul Russell, Nov 3, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    369
    Paul Russell
    Nov 3, 2003
  3. Replies:
    3
    Views:
    336
    Chris Uppal
    Mar 10, 2006
  4. Replies:
    0
    Views:
    621
  5. Wendell Buckner

    HowTo: expose web.config to client?

    Wendell Buckner, Oct 31, 2005, in forum: ASP .Net Web Services
    Replies:
    1
    Views:
    288
    Oleg Kap
    Oct 31, 2005
Loading...

Share This Page