I was given such XSD for a service response:
<xs:element name="AddEditResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="1" maxOccurs="1" name="response" type="xs:boolean"/>
</xs:sequence>
</xs:complexType>
</xs:element>
Notice that the name of the only element in response message is "response".
[ServiceContract]
[XmlSerializerFormat]
public interface IService
{
[OperationContract]
[return:XmlElement("return")]
bool AddEdit(MultipleElements elements);
}
I applied XmlElement attribute to the return value of AddEdit operation, but I'm still getting the following XSD:
<xs:element name="AddEditResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="1" maxOccurs="1" name="AddEditResult" type="xs:boolean"/>
</xs:sequence>
</xs:complexType>
</xs:element>
The name of the element inside the AddEditResponse element stays the same regardless of name in [return:XmlElement] attribute.
Why is this happening? Is there any way to customize such details of data exchange format in WCF?
Thanks.