Issues with web references and proxy classes.

J

Joe G

Good Morning;

When the WSDL.exe and/or webreference generates a proxy class for a webservice which receives/returns a custom object the class representation within the proxy class is incomplete. When the proxy class imports the object definition it leaves the root node attributes off the object root node which causes the code to blow up. (below is the example). Is there a way to foce the inclusion of the root node definition from the object class? Seems sloppy to have to modify the proxy class and/or include code to fix the root node (on very bottom). Any help would be very very appreciated.

There are 2 ways to solve the problem I know of which neither I like and was wondering if anyone knew a better solution.

Proxy class modification....

[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://MySchema.Name";)]
[System.Xml.Serialization.XmlRoot(Namespace"http://MySchema.Name";)] // <--- I HAD TO ADD THIS TO MAKE IT
public class Entities {
// ..............
}

//------------------------------------------------------------------------
// Code change
//------------------------------------------------------------------------
XmlRootAttribute xmlRoot = new XmlRootAttribute();
XmlAttributes attrs = new XmlAttributes();
XmlAttributeOverrides overrides = new XmlAttributeOverrides();
xmlRoot.Namespace = "http://MySchema.Name";;
attrs.XmlRoot = xmlRoot;
overrides.Add(typeof(KeyIDAccess.Entities), attrs);
serializer = new XmlSerializer(typeof(KeyIDAccess.Entities), overrides);
//
//------------------------------------------------------------------------
 
D

Dino Chiesa [Microsoft]

See my reply to your post of 29 April.

I am having trouble understanding just what you are doing, and what is going
wrong. I am guessing that others on this group are having similar
troubles, and this is why you got no response the first time 'round. It's
not that no-one saw your post (so re-posting the exact msg does not help).
It's that we don't get it.

We're here to help but you need to spell it out more simply to us,
sometime.s
-D

Joe G said:
Good Morning;

When the WSDL.exe and/or webreference generates a proxy class for a
webservice which receives/returns a custom object the class representation
within the proxy class is incomplete. When the proxy class imports the
object definition it leaves the root node attributes off the object root
node which causes the code to blow up. (below is the example). Is there a
way to foce the inclusion of the root node definition from the object class?
Seems sloppy to have to modify the proxy class and/or include code to fix
the root node (on very bottom). Any help would be very very appreciated.
There are 2 ways to solve the problem I know of which neither I like and
was wondering if anyone knew a better solution.
Proxy class modification....

[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://MySchema.Name";
)]
[System.Xml.Serialization.XmlRoot(Namespace"http://MySchema.Name";)] //
<--- I HAD TO ADD THIS TO MAKE IT
 

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

Forum statistics

Threads
473,995
Messages
2,570,233
Members
46,820
Latest member
GilbertoA5

Latest Threads

Top