.NETGURU
Sending / returning objects
Messages   Related Types
This message was discovered on microsoft.public.dotnet.framework.aspnet.webservices.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.
Post a new message to this list...

Morten
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 to this message...
 
    
Dino Chiesa [Microsoft] (VIP)
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" <Click here to reveal e-mail address> wrote in message
news:%Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
Morten
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]" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
Jeffrey Hasan
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" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
> Hmm... Not entirely sure that I understand. Does this mean that I can get
a
[Original message clipped]

Reply to this message...
 
 




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification