Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > Sending / returning objects

Reply
Thread Tools

Sending / returning objects

 
 
Morten
Guest
Posts: n/a
 
      09-08-2004
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


 
Reply With Quote
 
 
 
 
Dino Chiesa [Microsoft]
Guest
Posts: n/a
 
      09-08-2004
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" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
 
 
 
Morten
Guest
Posts: n/a
 
      09-08-2004
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]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
>> 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
>>
>>

>
>



 
Reply With Quote
 
Jeffrey Hasan
Guest
Posts: n/a
 
      09-13-2004
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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]" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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" <(E-Mail Removed)> wrote in message
> > news:%(E-Mail Removed)...
> >> 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
> >>
> >>

> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem with sending and returning value in/from stored proc Bob ASP .Net 2 11-10-2007 11:02 AM
class objects, method objects, function objects 7stud Python 11 03-20-2007 06:05 PM
returning none when it should be returning a list? randomtalk@gmail.com Python 11 05-02-2006 10:26 AM
Returning page to current position after sending request to server =?Utf-8?B?RGV2aW4=?= ASP .Net 1 04-20-2004 05:11 AM
Sending messages to a menu but never returning SNutter C Programming 4 01-16-2004 06:46 PM



Advertisments