Generating the Web Service code from C# class.

Discussion in 'ASP .Net Web Services' started by Jean-Francois Hamelin, Jun 11, 2004.

  1. Hi,

    I have a C# class and I have to expose it through a Web Service, but I don't
    want to write the Web Service, is there a generator that can produce the
    ..asmx file based on my .cs file?

    Thanks
    JF
    Jean-Francois Hamelin, Jun 11, 2004
    #1
    1. Advertising

  2. Jean-Francois Hamelin

    [MSFT] Guest

    Hi Jean,

    Not sure if there is wsuch one. Maybe you can search with google or in
    www.gotdotnet.com.

    Anyway, I don't think it is very difficut to create such a web service. For
    example, you can add such a function first:

    public MyClass MyClassFactory()
    {
    ...
    }

    This class will generate a object from your class. Then create a web method
    like:

    [WebMethod]
    public MyClass WebClass()
    {
    return MyClassFactory();

    }

    For a web service, we need to create the virtual folder and consider
    deployment issues. Therefore, I prefer doing it myself instead of some
    third party tools. Do you think so?


    Luke
    [MSFT], Jun 14, 2004
    #2
    1. Advertising

  3. Thanks for the reply, I was looking more for a complete wrapping of my
    class, but I like the idea of using a factory pattern. My concern is I want
    to maintain my class and not the web service interface, which I can achieve
    by using the factory pattern, here I write the factory only once.

    Thanks
    JF


    "[MSFT]" <> wrote in message
    news:...
    > Hi Jean,
    >
    > Not sure if there is wsuch one. Maybe you can search with google or in
    > www.gotdotnet.com.
    >
    > Anyway, I don't think it is very difficut to create such a web service.

    For
    > example, you can add such a function first:
    >
    > public MyClass MyClassFactory()
    > {
    > ...
    > }
    >
    > This class will generate a object from your class. Then create a web

    method
    > like:
    >
    > [WebMethod]
    > public MyClass WebClass()
    > {
    > return MyClassFactory();
    >
    > }
    >
    > For a web service, we need to create the virtual folder and consider
    > deployment issues. Therefore, I prefer doing it myself instead of some
    > third party tools. Do you think so?
    >
    >
    > Luke
    >
    Jean-Francois Hamelin, Jun 16, 2004
    #3
  4. Jean-Francois Hamelin

    [MSFT] Guest

    If you have only one or two class, you can just factory code once. If you
    need to work with multiple code, I think you can add a parameters to the
    Factory class, to specify the class you wan to create. This also require we
    change the code for each of class. Anyway, the change is very little.

    Luke
    [MSFT], Jun 17, 2004
    #4
  5. I will prototype some of your ideas.

    Thanks
    JF

    "[MSFT]" <> wrote in message
    news:...
    > If you have only one or two class, you can just factory code once. If you
    > need to work with multiple code, I think you can add a parameters to the
    > Factory class, to specify the class you wan to create. This also require

    we
    > change the code for each of class. Anyway, the change is very little.
    >
    > Luke
    >
    Jean-Francois Hamelin, Jun 17, 2004
    #5
    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. mygoogleac
    Replies:
    0
    Views:
    384
    mygoogleac
    Sep 30, 2004
  2. mygoogleac
    Replies:
    0
    Views:
    360
    mygoogleac
    Oct 12, 2004
  3. Lloyd Sheen

    Generating HTML in a web service

    Lloyd Sheen, Jul 3, 2007, in forum: ASP .Net
    Replies:
    6
    Views:
    458
    =?Utf-8?B?U2VyZ2V5IFBvYmVyZXpvdnNraXk=?=
    Jul 4, 2007
  4. JOHN HORST

    Generating a Web Service Class from WSDL?

    JOHN HORST, Jun 29, 2006, in forum: ASP .Net Web Services
    Replies:
    3
    Views:
    511
  5. Leo Violette
    Replies:
    0
    Views:
    1,000
    Leo Violette
    Apr 17, 2009
Loading...

Share This Page