Inside Microsoft CRM

8.26.2004

More fun with XSD

Torsten Schuster asked about the XML serializer, but unfortunately it was pretty buried. I saw it, but I'm not sure anyone else did. It sounds to me like another case of old CRM XSD and the VS XSD tool, but I'm not really sure.

From what I gather the platform and APIs are behaving correctly. For example, on a sales order retrieve, the following column set can be passed in.


<columnset>
<column>salesorderid</column>
<column>ordernumber</column>
<column>name</column>
<column>customerid</column>
<column>customfield</column>
</columnset>


Which should (and in this case, does) result in the following XML.


<salesorder>
<salesorderid>{CA033A28-25FD-47E4-A98A-BDDF134B11F3}</salesorderid>
<ordernumber>ORD-01001-54ZQ8T</ordernumber>
<name>Test</name>
<customerid name="STM Ltd." dsc="0" type="1">{3E8CDBD0-FD2E-409D-BB8D-39870AB689C1}</customerid>
<customfield>stm_4711</customfield>
</salesorder>


The question is about the "customerid" element and why the serializer isn't pulling it into the hydrated object. I can only guess, but it sounds like the XSD doesn't have a correct definition for "salesorder" nor does it have a definition for "customerid".

Ideally, the sales order XSD should have a "customerid" element of type "tns:customerType" which references this XSD


<xsd:complexType name="customerType">
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:int" use="required" />
<xsd:attribute name="dsc" type="xsd:int" />
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>


I can't guarantee that the VS XSD tool will cope well with the XSD that I talked about earlier. Although making the XSD tool deal with it is fairly trivial, I still prefer the other code generator.

Like I said a while back, I can't support any of this stuff, but I can lend guidance on occasion. Hopefully this information is enough to get things moving again. If not, well, maybe someone else can chime in.