I have a business-specific internal XSD that we use to represent business-level exceptions (that is: not necessarily in the code, but errors in the process) so that the various business units can inform each other, single processes fail.
I was instructed to write a component to record these exceptions along with their original requests and (if possible) a generated response. This all happens through biztalk, so I can’t just take the data and write it to the database: I need to return the XmlDocument to the original BizTalk orchestra so that our Orchestra organization can work with it.
Well, all of this makes sense (at least within the business - I see other ways to do it, but it works for us). The problem is this: I have Xsd with several nested elements, including the original XML request and possibly the original XML response. I can create a class in which all this is wonderful. I can take the data passed to the class and instantiate just fine.
However, when I call XmlSerializer to create the ExceptionMessage that I need, it generates its own XML instead of using the xsd that I want. I hope that soneone here can tell me that IXmlSerializable does not implement and sets up my serialization, that I can get XmlSerializer to take an instance of the class and map it to a specific xsd.
Something along the lines of:
XmlSerializer ser = new XmlSerializer(typeOf(myClass), "mySchema.xsd");
ser.Serialize(myStream, myInstance);
, . , VS2005.