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);
//
//------------------------------------------------------------------------
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);
//
//------------------------------------------------------------------------