Referencing Web-service (2005)

Discussion in 'ASP .Net' started by Mantorok, Mar 20, 2006.

  1. Mantorok

    Mantorok Guest

    Hi all

    I have a web-service that references another project (the component) that
    actually carries out the work, the web-service is simply acting as the public
    interface.

    The web-service on occasion may return a class that is defined in the component
    project.

    When I reference the web-service from a new project will it pick up these
    classes that are defined in the component project? Or will they be ignored
    and I'll end up with a broken web-service.

    The reason I'm asking is because Beta 2 failed to do this and I'm not sure
    if the released version will work, and unfortunately I haven't got time to
    check it.

    HTMS
    Any ideas?
    Thanks

    Kev
    Mantorok, Mar 20, 2006
    #1
    1. Advertising

  2. Mantorok

    Ray Booysen Guest

    Mantorok wrote:
    > Hi all
    >
    > I have a web-service that references another project (the component)
    > that actually carries out the work, the web-service is simply acting as
    > the public interface.
    >
    > The web-service on occasion may return a class that is defined in the
    > component project.
    >
    > When I reference the web-service from a new project will it pick up
    > these classes that are defined in the component project? Or will they be
    > ignored and I'll end up with a broken web-service.
    >
    > The reason I'm asking is because Beta 2 failed to do this and I'm not
    > sure if the released version will work, and unfortunately I haven't got
    > time to check it.
    >
    > HTMS
    > Any ideas?
    > Thanks
    >
    > Kev
    >
    >

    If your web service returns objects that are defined by the component
    project, you'll need those classes defined in the project that is
    calling the webservice. The project cannot figure out what is being
    passed otherwise.
    Ray Booysen, Mar 20, 2006
    #2
    1. Advertising

  3. Mantorok

    Mantorok Guest

    > Mantorok wrote:
    >
    >> Hi all
    >>
    >> I have a web-service that references another project (the component)
    >> that actually carries out the work, the web-service is simply acting
    >> as the public interface.
    >>
    >> The web-service on occasion may return a class that is defined in the
    >> component project.
    >>
    >> When I reference the web-service from a new project will it pick up
    >> these classes that are defined in the component project? Or will they
    >> be ignored and I'll end up with a broken web-service.
    >>
    >> The reason I'm asking is because Beta 2 failed to do this and I'm not
    >> sure if the released version will work, and unfortunately I haven't
    >> got time to check it.
    >>
    >> HTMS
    >> Any ideas?
    >> Thanks
    >> Kev
    >>

    > If your web service returns objects that are defined by the component
    > project, you'll need those classes defined in the project that is
    > calling the webservice. The project cannot figure out what is being
    > passed otherwise.
    >


    My work-around before was to create some classes in the web-service itself
    and only pass them back to the caller, this seemed to work fine.

    Maybe I shouldn't be passing back types that have been defined in the component
    project - are there any general guidelines for this sort of scenario?

    Thanks
    Kev
    Mantorok, Mar 20, 2006
    #3
  4. Mantorok

    CMM Guest

    >> If your web service returns objects that are defined by the component
    >> project, you'll need those classes defined in the project that is
    >> calling the webservice.


    I'm not sure if that's entirely true. If the class in question is a simple
    structure of primitive types or arrays (sometimes called a "document"), any
    client (.NET, Java, or otherwise) will recontruct the class without any
    extra help (it's automatically defined in the WSDL).

    However, if the class is "fat" and does work (sometimes called an "entity")
    then you're right... and you'll need to put your entity class
    implementations in a complimentary DLL that is installed on both the client
    and server.

    --
    -C. Moya
    www.cmoya.com
    "Mantorok" <> wrote in message
    news:...
    >> Mantorok wrote:
    >>
    >>> Hi all
    >>>
    >>> I have a web-service that references another project (the component)
    >>> that actually carries out the work, the web-service is simply acting
    >>> as the public interface.
    >>>
    >>> The web-service on occasion may return a class that is defined in the
    >>> component project.
    >>>
    >>> When I reference the web-service from a new project will it pick up
    >>> these classes that are defined in the component project? Or will they
    >>> be ignored and I'll end up with a broken web-service.
    >>>
    >>> The reason I'm asking is because Beta 2 failed to do this and I'm not
    >>> sure if the released version will work, and unfortunately I haven't
    >>> got time to check it.
    >>>
    >>> HTMS
    >>> Any ideas?
    >>> Thanks
    >>> Kev
    >>>

    >> If your web service returns objects that are defined by the component
    >> project, you'll need those classes defined in the project that is
    >> calling the webservice. The project cannot figure out what is being
    >> passed otherwise.
    >>

    >
    > My work-around before was to create some classes in the web-service itself
    > and only pass them back to the caller, this seemed to work fine.
    >
    > Maybe I shouldn't be passing back types that have been defined in the
    > component project - are there any general guidelines for this sort of
    > scenario?
    >
    > Thanks
    > Kev
    >
    >
    CMM, Mar 20, 2006
    #4
  5. Mantorok

    Ray Booysen Guest

    CMM wrote:
    >>> If your web service returns objects that are defined by the component
    >>> project, you'll need those classes defined in the project that is
    >>> calling the webservice.

    >
    > I'm not sure if that's entirely true. If the class in question is a simple
    > structure of primitive types or arrays (sometimes called a "document"), any
    > client (.NET, Java, or otherwise) will recontruct the class without any
    > extra help (it's automatically defined in the WSDL).
    >
    > However, if the class is "fat" and does work (sometimes called an "entity")
    > then you're right... and you'll need to put your entity class
    > implementations in a complimentary DLL that is installed on both the client
    > and server.
    >

    You're right. My brain switched off for a while. ;)
    Ray Booysen, Mar 20, 2006
    #5
  6. Mantorok

    CMM Guest

    VS2005/.NET 2.0 does a really good job of serializing classes. A lot of the
    types and collections (like the infinitely very useful List(of <T>)) and
    even deeply nested classes are recognized by the serializer and turned into
    XML primitives and arrays and defined in the WSDL. The client (.NET, Java,
    or whatever) should have no trouble reconstructing these classes... they're
    described quite well in the WSDL.

    However, this is only practical for classes that contain only data (document
    paradigm)... not for classes that contain built-in validation or otherwise
    do "work" (entity paradigm).

    --
    -C. Moya
    www.cmoya.com
    "Mantorok" <> wrote in message
    news:...
    > Hi all
    >
    > I have a web-service that references another project (the component) that
    > actually carries out the work, the web-service is simply acting as the
    > public interface.
    >
    > The web-service on occasion may return a class that is defined in the
    > component project.
    >
    > When I reference the web-service from a new project will it pick up these
    > classes that are defined in the component project? Or will they be ignored
    > and I'll end up with a broken web-service.
    >
    > The reason I'm asking is because Beta 2 failed to do this and I'm not sure
    > if the released version will work, and unfortunately I haven't got time to
    > check it.
    >
    > HTMS
    > Any ideas?
    > Thanks
    >
    > Kev
    >
    >
    CMM, Mar 20, 2006
    #6
  7. Mantorok

    Mantorok Guest

    > VS2005/.NET 2.0 does a really good job of serializing classes. A lot
    > of the types and collections (like the infinitely very useful List(of
    > <T>)) and even deeply nested classes are recognized by the serializer
    > and turned into XML primitives and arrays and defined in the WSDL. The
    > client (.NET, Java, or whatever) should have no trouble reconstructing
    > these classes... they're described quite well in the WSDL.
    >
    > However, this is only practical for classes that contain only data
    > (document paradigm)... not for classes that contain built-in
    > validation or otherwise do "work" (entity paradigm).
    >


    Thanks for that - I thought as much, I'll try and stick to the document paradigm
    for returned types.

    Kev
    Mantorok, Mar 21, 2006
    #7
  8. Mantorok

    Russell Guest

    The web reference generates proxies that reflect public variables and
    properties of the class the web method is declared as returning. Even
    if you add the reference to the original class, what you'll get back
    from the service is the proxy class. If you want to work with an
    instance of the original class you'll need to construct one from the
    proxy object that is returned.
    Russell, Mar 21, 2006
    #8
    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. =?Utf-8?B?TWF0dEJlbGw=?=

    Referencing other web projects within Visual Studio 2005

    =?Utf-8?B?TWF0dEJlbGw=?=, Jan 12, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    410
    S. Justin Gengo [MCP]
    Jan 12, 2006
  2. ITistic
    Replies:
    2
    Views:
    413
    ITistic
    Aug 21, 2007
  3. George Kenyon
    Replies:
    0
    Views:
    695
    George Kenyon
    Mar 24, 2009
  4. Mike Dearman
    Replies:
    1
    Views:
    179
    Mike Dearman
    Jun 23, 2004
  5. z f

    referencing web service on the same web project

    z f, Mar 26, 2006, in forum: ASP .Net Web Services
    Replies:
    2
    Views:
    110
Loading...

Share This Page