Serialization problem

  • Thread starter Thread starter Alvin Bruney [MVP]
  • Start date Start date
A

Alvin Bruney [MVP]

I'm pushing a class across the wire thru a webservice. The class contains a
nested structure. On the client-side, the deserialized class does not
contain the embedded structure. It is simply a class and a structure on the
receiving end. Is this normal? How do I enforce the schema across the
serialization layer?
 
If you are using VS.NET, it should be realtively clear that it is normal
that the scheme/class structure does get transmitted as part of the response
of the webservice. This is handled automatically.

- Noah Coad -
Microsoft MVP
 
I don't understand your response. Can you go into more detail?

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
Noah Coad said:
If you are using VS.NET, it should be realtively clear that it is normal
that the scheme/class structure does get transmitted as part of the response
of the webservice. This is handled automatically.

- Noah Coad -
Microsoft MVP


Alvin Bruney said:
I'm pushing a class across the wire thru a webservice. The class
contains
a
nested structure. On the client-side, the deserialized class does not
contain the embedded structure. It is simply a class and a structure on the
receiving end. Is this normal? How do I enforce the schema across the
serialization layer?

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
 
When you are working with a project in VS.NET, and you want to add a
reference to a webservice, you right click on the "References" line under
your project's name in the "Solution Explorer", and choose "Add Web
Reference..." to add a webservice. Then, when you use the webservice, it
will look something like this in your code:

net.noah.coad.MyService ms = new net.noah.coad.MyService();
string phone = ms.LookupPhoneNumber("Noah Coad");

All the information on the _type_ of data being passed to and from the
webservice is downloaded by VS.NET from the webservice and stored as
somewhat of a proxy on your local system. So if the "LookupPhoneNumber"
method returned a more complex structure, that sturcutre, as long as it can
be serialized by the CLR, will look like it exists on your computer, even
though the original definiation is kept by the webservice. For Example:

net.noah.coad.AddressStruct addr = ms.LookupAddress("Noah Coad");

Since the webservice uses a struct called "AddressStruc", it will also be
avalible in your local project since you added the web reference to the
webservice.

Does this make more sense?

- Noah Coad -
Microsoft MVP

Alvin Bruney said:
I don't understand your response. Can you go into more detail?

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
Noah Coad said:
If you are using VS.NET, it should be realtively clear that it is normal
that the scheme/class structure does get transmitted as part of the response
of the webservice. This is handled automatically.

- Noah Coad -
Microsoft MVP


Alvin Bruney said:
I'm pushing a class across the wire thru a webservice. The class
contains
a
nested structure. On the client-side, the deserialized class does not
contain the embedded structure. It is simply a class and a structure
on
the
receiving end. Is this normal? How do I enforce the schema across the
serialization layer?

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
 
Does this make more sense?

I'm not asking about design time. The client, at runtime, requests data from
the webservice. It returns an object (to use your example). it would return
net as an object. the client creates a class from that object and he would
like to call net.noah.coad.MyService. but intellisense shows the myService
attached to the net object like so net.MyService and net.Noah and net.coad
which is a different schema from what was sent to it from the server. the
server sent a correct nested object of net.noah.coad. Attempting to call
net.noah.coad.MyService on the client results in a compile time error.

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
Noah Coad said:
When you are working with a project in VS.NET, and you want to add a
reference to a webservice, you right click on the "References" line under
your project's name in the "Solution Explorer", and choose "Add Web
Reference..." to add a webservice. Then, when you use the webservice, it
will look something like this in your code:

net.noah.coad.MyService ms = new net.noah.coad.MyService();
string phone = ms.LookupPhoneNumber("Noah Coad");

All the information on the _type_ of data being passed to and from the
webservice is downloaded by VS.NET from the webservice and stored as
somewhat of a proxy on your local system. So if the "LookupPhoneNumber"
method returned a more complex structure, that sturcutre, as long as it can
be serialized by the CLR, will look like it exists on your computer, even
though the original definiation is kept by the webservice. For Example:

net.noah.coad.AddressStruct addr = ms.LookupAddress("Noah Coad");

Since the webservice uses a struct called "AddressStruc", it will also be
avalible in your local project since you added the web reference to the
webservice.

Does this make more sense?

- Noah Coad -
Microsoft MVP

Alvin Bruney said:
I don't understand your response. Can you go into more detail?

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
Noah Coad said:
If you are using VS.NET, it should be realtively clear that it is normal
that the scheme/class structure does get transmitted as part of the response
of the webservice. This is handled automatically.

- Noah Coad -
Microsoft MVP


"Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
I'm pushing a class across the wire thru a webservice. The class contains
a
nested structure. On the client-side, the deserialized class does not
contain the embedded structure. It is simply a class and a structure on
the
receiving end. Is this normal? How do I enforce the schema across the
serialization layer?

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
 
If the WebService changes, you'll encounter this problem, that the scheme
changed without the client knowing. In this case, the WebService structure
being changed, the client's code would fail. The client would have to
re-download the update scheme by right clicking on the Web reference in
VS.NET and selecting "Update Web Reference". This would provide the client
with the most up-to-date scheme/classes.


Alvin Bruney said:
Does this make more sense?

I'm not asking about design time. The client, at runtime, requests data from
the webservice. It returns an object (to use your example). it would return
net as an object. the client creates a class from that object and he would
like to call net.noah.coad.MyService. but intellisense shows the myService
attached to the net object like so net.MyService and net.Noah and net.coad
which is a different schema from what was sent to it from the server. the
server sent a correct nested object of net.noah.coad. Attempting to call
net.noah.coad.MyService on the client results in a compile time error.

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
Noah Coad said:
When you are working with a project in VS.NET, and you want to add a
reference to a webservice, you right click on the "References" line under
your project's name in the "Solution Explorer", and choose "Add Web
Reference..." to add a webservice. Then, when you use the webservice, it
will look something like this in your code:

net.noah.coad.MyService ms = new net.noah.coad.MyService();
string phone = ms.LookupPhoneNumber("Noah Coad");

All the information on the _type_ of data being passed to and from the
webservice is downloaded by VS.NET from the webservice and stored as
somewhat of a proxy on your local system. So if the "LookupPhoneNumber"
method returned a more complex structure, that sturcutre, as long as it can
be serialized by the CLR, will look like it exists on your computer, even
though the original definiation is kept by the webservice. For Example:

net.noah.coad.AddressStruct addr = ms.LookupAddress("Noah Coad");

Since the webservice uses a struct called "AddressStruc", it will also be
avalible in your local project since you added the web reference to the
webservice.

Does this make more sense?

- Noah Coad -
Microsoft MVP

Alvin Bruney said:
I don't understand your response. Can you go into more detail?

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
If you are using VS.NET, it should be realtively clear that it is normal
that the scheme/class structure does get transmitted as part of the
response
of the webservice. This is handled automatically.

- Noah Coad -
Microsoft MVP


"Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
I'm pushing a class across the wire thru a webservice. The class
contains
a
nested structure. On the client-side, the deserialized class does not
contain the embedded structure. It is simply a class and a
structure
on
the
receiving end. Is this normal? How do I enforce the schema across the
serialization layer?

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
 
Back
Top