How to convince WCF Data Contract Serializer that a WSDL is doc/lit/wrapped

1.6k views Asked by At

I've tried to follow the guidance at http://blogs.msdn.com/b/donsmith/archive/2006/10/06/handcrafting-wcf_2d00_friendly-wsdls.aspx for creating a WSDL that the WCF svcutil will believe is in the document/literal wrapped format. In so doing, svcutil should generate a service interface and proxy code in C# that uses the data contract serializer, and OperationContractAttributes on the wrapper operations. Instead I get a weird double-wrapping with BlahResponse1 classes nested in BlahResponse clases, and svcutil tells me the WSDL is not wrapped and that it will create MessageContracts rather than OperationContracts.

For the sake of code-readability by my service consumers, I want to get rid of the BlahResponse1 class, and convince svcutil that the WSDL is wrapped. How does one do that? Maybe also, how does one not do that?

I've seen suggestions to set nillable="true" on some but not all elements in the schema which will become the data contract. Which should be nillable and why? Would there ever need to be elements that are not nillable, where setting nillable="true" is bad?

I tried dividing the schema into two namespaces as the above link suggests, but that didn't seem to work (or was masked by another problem). Is there anything about schema namespaces, imports versus includes, and orders of declaration that are important?

I would include the schema/WSDLs, but the are kind of proprietary. Also, very large and spread across many files.

1

There are 1 answers

1
Greg On

XMLSpy creates message parts with a default name of "parameter." That is almost what .NET svcutil.exe needs to autogenerate data contracts and operation contracts. Svcutil.exe needs all message parts to be named "parameters" (notice the added 's' at the end).