Is elementFormDefault = “unqualified” possible?

Topics: General Discussion Forum, July and December Releases Forum, Service Factory Modeling Edition Forum
Apr 11, 2008 at 10:38 AM
Hi there Gurus

I’ve just made a WCF service using the service factory and the DataContractSerializer.

Everything works just fine, but our partner, who is using this service as a plain old web service, can’t handle the elementFormDefault = “qualified”, which seems to be the default?

How can I change my service to return responses like this:

<GetPersonDataResponse xmlns="http://mit.3f.dk/crm/scm/2008/04">
<PersonBasics xmlns:a="http://mit.3f.dk/crm/dcm/2008/04" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<PersonCivilRegistrationIdentifier>123</PersonCivilRegistrationIdentifier>
<PersonNameStructure>
<PersonGivenName>Michael</PersonGivenName>
<PersonMiddleName>Henning</PersonMiddleName>
<PersonSurnameName>Egevad</PersonSurnameName>
</PersonNameStructure>
</ PersonBasics >
</ GetPersonDataResponse >

Instead of returning responses like this

<GetPersonDataResponse xmlns="http://mit.3f.dk/crm/scm/2008/04">
<PersonBasics xmlns:a="http://mit.3f.dk/crm/dcm/2008/04" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<a:PersonCivilRegistrationIdentifier>123</a:PersonCivilRegistrationIdentifier>
<a:PersonNameStructure>
<a:PersonGivenName>Michael</a:PersonGivenName>
<a:PersonMiddleName>Henning</a:PersonMiddleName>
<a:PersonSurnameName>Egevad</a:PersonSurnameName>
</a:PersonNameStructure>
</ PersonBasics >
</ GetPersonDataResponse >

Best regards,

Michael Brandt Lassen
3F, Denmark

Apr 11, 2008 at 11:15 AM
Hi again Gurus

I’ve now realised that the DataContractSerializer is incompatible with schemas using the attribute elementFormDefault = “Unqualified”, so I guess I’ll have to use the XmlSerializer then?

Unfortunately this means that I’ll have to redo all my DataContracts in schema now instead of using the DSL graphical tool… I’m I right on this?

Using the XmlSerialiser and combining datatypes from schema and the DSL graphical DataContact-tool I get this error message:

You must use the DataContractSerializer on the Service Contract model since there are message contracts on the Service contract model referencing a Data Contract Model which uses the WCF extender

Best regards,

Michael Brandt Lassen
3F, Denmark
Developer
Apr 11, 2008 at 10:01 PM
I'm afraid you are right, if you need to use the XmlSerializer, then you should use all schema types or otherwise use DC with ASMX extender that supports the XmlSerializer. Another option that you may try (under your own risk) is removing that rule from the ruleset.config file. For that you can search for "ImplementationTechnologyAndSerializerCrossModelValidator" and comment that validator element entry (line 382).