WCF code generation for large/complex schema (HR-XML/OAGIS) - is there an alternative?
Posted
by Sasha Borodin
on Stack Overflow
See other posts from Stack Overflow
or by Sasha Borodin
Published on 2010-03-16T20:12:26Z
Indexed on
2010/03/16
21:31 UTC
Read the original article
Hit count: 282
Hello, and thank you for reading.
I am implementing a WCF Service based on a predefined specification (HR-XML 3.0). As such, I am starting with the schema, and working my way back to code. There are a number of large Schema documents (which import yet more Schema documents) related to my implementation, provided by this specification.
I am able to generate code using xsd.exe, by supplying the "main" and "supporting" xsd files as arguments. But there are several issues, and I am wondering if this is the right approach.
- there are litterally hundreds of classes - the code file is half a meg in size
- duplicate classes (ex. Type, Type1 - which both represent the same type)
- there are classes declared as inheriting from a base class, but that base class is not generated/defined
I understand that there are limitations to the types of Schema supported by svcutil.exe/xsd.exe when targeting the DataContractSerializer and even XmlSerializer. My question is two-fold:
- Are code generation "issues" fairly common when dealing with larger, modular xsd files? Has anyone had success with generating data contracts from OAGIS or HR-XML schema?
- Given the above issues, are there better approaches to this task, avoiding generating code and working with concrete objects? Does it make better sence to read and compose a SOAP message directly, while still taking advantage of the rest of the WCF framework? I understand that I am loosing the convenience of working with .NET objects, and the framekwork-provided (de)serialization; given these losses, would it still be advantageous to base my Service on WCF? Is there some "middle ground" between working with .NET types and pure XML?
Thank you very much!
-Sasha Borodin DFWHC.org
© Stack Overflow or respective owner