I’m using WCF to create a SOAP web service, with predefined XSD contract, and C# types auto-generated from that XSD.
[ServiceContract]
[XmlSerializerFormat]
public interface IEBooking10
{
[OperationContract]
[XmlSerializerFormat]
OTA_CancelRS OTA_Cancel(OTA_CancelRQ rq);
}
OTA_CancelRQ & OTA_CancelRS are auto-generated types, with corresponding XML serialization attributes.
The parameters get wrapped in OTA_Cancel and OTA_CancelResponse elements, like this:
<OTA_Cancel>
<OTA_CancelRQ> ... </OTA_CancelRQ>
</OTA_Cancel>
and
<OTA_CancelResponse>
<OTA_CancelRS> ... </OTA_CancelRS>
</OTA_CancelResponse>
How can I avoid wrapping that WCF does to input parameters of the OTA_Cancel operation?
That is not handled by serialization but by message definition. At the moment you are using defaults which says that serialized data must be wrapped but the operation element. If you want to overwrite this behavior you must use message contracts. Try something like this: