Serialization / Deserialization across WebService Calls

R

Robert Millman

A have a few questions related to how parameters and return types are serialized/deserialized across WebService calls. Here is my scenario

A web method takes two strings as parameters and returns an instance of a custom object of type "WebService.MyClass". The proxy object that is generated in VS.Net contains the signature of the Web Method call, and also contains a "shell" definition for my custom class. However, the name space for this shell is now "ClientApp.Alias.MyClass"

A couple of questions

1) In my client code, I make the web method call and receive the returned value. However, I do not have the full class definition and cannot access methods, etc. on it, as the proxy object only contains a shell outlining the public variables. How do I cast the returned object from type "ClientApp.Alias.MyClass" to WebService.MyClass? Also realize that the "ClientApp.Alias" namespace will vary from project to project, depending on naming conventions, etc
2) How do get private members of my custom class to participate in the serialization so that I receive a full functioning instance of my class

Thank

Robert Millman
 
M

MSFT

Hi Robert,

Thank you for using the community. As I understand, you want to convert the
class "WebService.MyClass" from a web service to local class
"ClientApp.Alias.MyClass", so that you can call its methods.

In fact, If there is no real defination in the proxy for
"ClientApp.Alias.MyClass", we can't call its method directly. As a work
around, we can create Library project assembly for the "MyClass" and
reference it in both of web service and client project. This require we put
the assembly ob both of server and client.

Another way is convert "MyClass" to a web service and its method to web
methods. In this way, the methods will be executed on server.

Does this answer your question?

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 

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

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top