How would you do that?

D

Diego F.

I'm stuck. Let's see if someone can help me.

Imagine you have to develop an application with some clients (Pocket PCs)
and a server. The clients will send custom objects (let's call them
myObject) to the server but later they will access again to these objects.
The server must then store the objects. myObject has some simple attributes
(strings, int,...) and any kind of collection (maybe myObject[], or
ArrayList, or simply Object[])

My first idea was using web services but I found a problem: the proxy
generates a serialized class myObject, with only the public properties and
the web methods expect to receive these new objects. An original myObject
can't be converted into these new objects.

The main problem is the collection. I don't usually expose collections as
public properties: instead I use methods and I avoid the user dealing with
collections. Also, I can change the kind of collection without modifying the
client code. But the proxy generates an Object[] and the clients have to
manage the new objects declared by the proxy.

Any ideas to send myObjects to the server?

Regards,

Diego F.
 
N

Nicholas Paldino [.NET/C# MVP]

Diego,

I would have your web method deal with strings. Basically, you can use
Serialization to serialize your object into a SOAP encoding, and then pass
that back through a string. Then, on the other side, you have to take the
string, and re-create the object using the SoapFormatter.

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top