Hi All,
I've created a WCF service which expects SOAP messages which are generated by the MessageContracts. However this seems to generate code in the XSD that I do not understand why it's there.
I created a MessageContract with the following element in it:
[System.Xml.Serialization.XmlElementAttribute("OrderNr", typeof(string))]
[System.Xml.Serialization.XmlElementAttribute("Status", typeof(StatusType))]
public object Item { get; set; }
I expect this to generate the following element in the XSD:
<xs:choice minOccurs="1" maxOccurs="1">
<xs:element minOccurs="0" maxOccurs="1" name="OrderNr" type="xs:string"/>
<xs:element minOccurs="0" maxOccurs="1" name="Status" type="StatusType"/>
</xs:choice>
However it creates the following:
<xs:choice minOccurs="1" maxOccurs="1">
<xs:element minOccurs="0" maxOccurs="1" name="OrderNr" type="xs:string"/>
<xs:element minOccurs="0" maxOccurs="1" name="Status" type="StatusType"/>
<xs:element minOccurs="0" maxOccurs="1" name="Item"/>
</xs:choice>
This is not that big of a problem when I send SOAP messages to this webservice, however when I create a webservice client through VS I get the message:
InvalidOperationException was unhandled: There was an error reflecting 'Item'.
Deeper in this expection is the following message: "You need to add XmlChoiceIdentifierAttribute to the 'Item' member."
All though it is not possible to add this annotation to this object, because the element has a wrapper element. The XmlChoiceIdentifier is not allowed when it is wrapped.
The problem seems to be caused by the extra element in the XSD. This has no type and can not be serialized by the generated client. This way we can not call the webservice trough C#.
Yours sincerely,
Mike Jesmiatka