Sending / returning objects

Discussion in 'ASP .Net Web Services' started by Morten, Sep 8, 2004.

  1. Morten

    Morten Guest

    Hi!

    I'm trying to figure out if it's possible to create an object in a
    webservice, return it (the object / representation of an object) to a
    client, make modifications on the client and push the changes back to the
    webservice?

    I'm guessing that you have to use remoting obejcts for something like this
    but I don't believe that will prove to be platform independent so that won't
    work in our environment.

    Any input is most welcome!

    Morten
    Morten, Sep 8, 2004
    #1
    1. Advertising

  2. Web services is a message-passing paradigm, not an object-remoting paradigm.
    It is possible to code an object and serialize its state to XML.
    You can ship that XML back-and-forth on a wire, modify it on either side.
    And at the end of this exchange, you can de-serialize from XML and
    instantiate an object from it once again.

    But as you can see, it is not the same object, it is a new object entirely.
    If your app can deal with this, then YES, you can accomplish what you want.
    On the other hand if you require that it be the SAME object, you have some
    more work to do.

    -D


    "Morten" <> wrote in message
    news:%...
    > Hi!
    >
    > I'm trying to figure out if it's possible to create an object in a
    > webservice, return it (the object / representation of an object) to a
    > client, make modifications on the client and push the changes back to the
    > webservice?
    >
    > I'm guessing that you have to use remoting obejcts for something like this
    > but I don't believe that will prove to be platform independent so that

    won't
    > work in our environment.
    >
    > Any input is most welcome!
    >
    > Morten
    >
    >
    Dino Chiesa [Microsoft], Sep 8, 2004
    #2
    1. Advertising

  3. Morten

    Morten Guest

    Hmm... Not entirely sure that I understand. Does this mean that I can get a
    copy of an object on the client, modify it using the normal methods - like
    the ones in my web service - and have these modifications take place in my
    webservice once I commit them?

    Best regards

    Morten

    "Dino Chiesa [Microsoft]" <> wrote in message
    news:...
    > Web services is a message-passing paradigm, not an object-remoting
    > paradigm.
    > It is possible to code an object and serialize its state to XML.
    > You can ship that XML back-and-forth on a wire, modify it on either side.
    > And at the end of this exchange, you can de-serialize from XML and
    > instantiate an object from it once again.
    >
    > But as you can see, it is not the same object, it is a new object
    > entirely.
    > If your app can deal with this, then YES, you can accomplish what you
    > want.
    > On the other hand if you require that it be the SAME object, you have some
    > more work to do.
    >
    > -D
    >
    >
    > "Morten" <> wrote in message
    > news:%...
    >> Hi!
    >>
    >> I'm trying to figure out if it's possible to create an object in a
    >> webservice, return it (the object / representation of an object) to a
    >> client, make modifications on the client and push the changes back to the
    >> webservice?
    >>
    >> I'm guessing that you have to use remoting obejcts for something like
    >> this
    >> but I don't believe that will prove to be platform independent so that

    > won't
    >> work in our environment.
    >>
    >> Any input is most welcome!
    >>
    >> Morten
    >>
    >>

    >
    >
    Morten, Sep 8, 2004
    #3
  4. As Dino pointed out, Web services are designed to exchange messages, which
    can correspond to an "object" as long as you have generated an XSD schema
    representation for the object. Web services are not designed to exhanged
    stateful "objects" across the wire in the same way that .NET Remoting allows
    you to do. And Web services cannot exchange "objects" that define their own
    methods. However, you can approximate this behavior to exchange an object
    with properties, as follows:

    1. Generate an XSD schema representation of the object.
    2. On the client, instance the object, set its properties, serialize it to
    XML and pass it to a Webmethod that is capable of accepting the object.
    3. In the Web method, deserialize the XML and hydrate a new instance of the
    object.
    4. In the Web method set/reset the properties as needed.
    5. Set the return type for the Web method to the object.

    The schema is important so that both client and service have an independent
    reference to an object type, since they must share a common understanding of
    this type.

    Final note: in VS.NET, all of the above can be accomplished by writing a
    type assembly for the object and referencing it in both client and service

    Hope this helps.

    Jeffrey Hasan, MCSD
    President, Bluestone Partners, Inc.
    -----------------------------------------------
    Author of: Expert SOA in C# Using WSE 2.0 (APress, 2004)
    http://www.bluestonepartners.com/soa.aspx

    "Morten" <> wrote in message
    news:...
    > Hmm... Not entirely sure that I understand. Does this mean that I can get

    a
    > copy of an object on the client, modify it using the normal methods - like
    > the ones in my web service - and have these modifications take place in my
    > webservice once I commit them?
    >
    > Best regards
    >
    > Morten
    >
    > "Dino Chiesa [Microsoft]" <> wrote in message
    > news:...
    > > Web services is a message-passing paradigm, not an object-remoting
    > > paradigm.
    > > It is possible to code an object and serialize its state to XML.
    > > You can ship that XML back-and-forth on a wire, modify it on either

    side.
    > > And at the end of this exchange, you can de-serialize from XML and
    > > instantiate an object from it once again.
    > >
    > > But as you can see, it is not the same object, it is a new object
    > > entirely.
    > > If your app can deal with this, then YES, you can accomplish what you
    > > want.
    > > On the other hand if you require that it be the SAME object, you have

    some
    > > more work to do.
    > >
    > > -D
    > >
    > >
    > > "Morten" <> wrote in message
    > > news:%...
    > >> Hi!
    > >>
    > >> I'm trying to figure out if it's possible to create an object in a
    > >> webservice, return it (the object / representation of an object) to a
    > >> client, make modifications on the client and push the changes back to

    the
    > >> webservice?
    > >>
    > >> I'm guessing that you have to use remoting obejcts for something like
    > >> this
    > >> but I don't believe that will prove to be platform independent so that

    > > won't
    > >> work in our environment.
    > >>
    > >> Any input is most welcome!
    > >>
    > >> Morten
    > >>
    > >>

    > >
    > >

    >
    >
    Jeffrey Hasan, Sep 13, 2004
    #4
    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?RGV2aW4=?=
    Replies:
    1
    Views:
    286
    Ashish M Bhonkiya
    Apr 20, 2004
  2. SNutter
    Replies:
    4
    Views:
    307
    SNutter
    Jan 16, 2004
  3. Replies:
    11
    Views:
    654
    Christos Georgiou
    May 2, 2006
  4. 7stud
    Replies:
    11
    Views:
    674
    Dennis Lee Bieber
    Mar 20, 2007
  5. Bob
    Replies:
    2
    Views:
    284
Loading...

Share This Page