Using c# and visual studio 2015
I'm working with an external webservice and I have build a service reference using a delivered WSDL. That is all working, and I can call the service, but I get a error because the request is not in correct format...
Part of the service definition is this:
<xsd:complexType name="GCTPLookupRequestType">
<xsd:sequence>
<xsd:element name="gctpMessage" type="xsd:string" minOccurs="1" maxOccurs="1" />
</xsd:sequence>
</xsd:complexType>
The gctpMessage is a string element but is expected to contain a CDATA section like this:
<![CDATA[
<Gctp v="1.0">
<System r="CprSoeg">
<Service r="STAM+">
<CprServiceHeader r="STAM+">
<Key>
<Field r="PNR" v="0000000000"/>
</Key>
</CprServiceHeader>
</Service>
</System>
</Gctp>
]]>
If I append this as a string as expected to the gctpMessage property all seems fine, but when I inspect the request using Fiddler I se that it is all wrong:
<gctpMessage>
<![CDATA[<Gctp v="1.0"><System r="CprSoeg"><
Service r="STAM+"><CprServiceHeader r="STAM+"><Key><
Field r="PNR" v="0000000000"/></Key></CprServiceHeader></
Service></System></Gctp>]]>
</gctpMessage>
I know this is caused by the XML serializer enterpreting this as a string and therefore escapes the tags.
But how do I get around this? The WSDL has defined it as a string and I really want to use the service reference but I do not know how to handle this... Changing the service is not an option.
Any suggestion would be appriciated :)