Please Help!
I have a SOAP WCF client with .Net Core and it is serializing the request to htmlEntity, I have the receiver and this is how it shows me!
<?xml version="1.0" encoding="utf-16"?>
<s:Envelope xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:s="http://www.w3.org/2003/05/soap-envelope">
<s:Header>
<a:Action s:mustUnderstand="1">urn:call3</a:Action>
<a:MessageID>urn:uuid:9fb7fe14-ace1-4b5f-b055-9f389606f527</a:MessageID>
<a:ReplyTo>
<a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
</a:ReplyTo>
</s:Header>
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<call3 xmlns="http://ws.allianz.com">
<xml><![CDATA[<?xml version="1.0" encoding="UTF-8"?><chargerequest><transactionnumber>12345</transactionnumber><authentication><company>COL</company><partnerid>CP239516</partnerid><agentid>CA626290</agentid><partnercode>CP239516</partnercode><agentcode>1703229</agentcode></authentication><operationheaders><operationtypecode>TA</operationtypecode><productcode>1251</productcode><policynumber>22310792</policynumber></operationheaders><effectivedate>20190312</effectivedate><TermDate>20200311</TermDate><firstbill>0</firstbill><successive>0</successive><holderdoctype>C</holderdoctype><holderdocnumber>17326334</holderdocnumber><ownerdoctype>C</ownerdoctype><ownerdocnumber>17326334</ownerdocnumber><isholderdriver>S</isholderdriver><isholderowner>S</isholderowner><isnewowner>S</isnewowner><risktype>L0001</risktype><vehicleplate>BIR039</vehicleplate><vehicleorigin>11001</vehicleorigin><vehiclefasecoldacode>l</vehiclefasecoldacode><vehicleyear>2013</vehicleyear><cap>0</cap><riskdata><ownerborndate>19691010</ownerborndate><ownersex>M</ownersex><repowered>N</repowered><protectiondevicecode>1</protectiondevicecode><accessoriesvalue>0.0</accessoriesvalue><shieldingvalue>0.0</shieldingvalue><gassystemvalue>0.0</gassystemvalue><insuredvalue>0.0</insuredvalue><isnewvehicle>N</isnewvehicle><continuity>N</continuity><circulationareadanecode>11001</circulationareadanecode></riskdata></chargerequest>]]></xml>
</call3>
</s:Body>
</s:Envelope>
The code in c # is as follows
var b = new NetHttpBinding();
b.Security.Mode = BasicHttpSecurityMode.Transport;
b.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate;
b.TransferMode = TransferMode.StreamedRequest;
b.MessageEncoding = NetHttpMessageEncoding.Text;
Encoding utf8 = new UTF8Encoding();
b.TextEncoding = utf8;
EndpointAddress ea = new EndpointAddress("https://endpointtest/WSHttpsSoap12Endpoint/");
AutosClonicoWSPortTypeClient clientService = new AutosClonicoWSPortTypeClient(b, ea);
var requestInterceptor = new InspectorBehavior();
clientService.Endpoint.EndpointBehaviors.Add(requestInterceptor);
clientService.ClientCredentials.ClientCertificate.SetCertificate(
StoreLocation.CurrentUser,
StoreName.Root,
X509FindType.FindBySerialNumber,
"NumberSerial");
await clientService.OpenAsync();
var res = await clientService.call3Async("<![CDATA[" + "<test><element>exampletest</element></test>" + "]]>");
The contract at the client level is as follows
[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.2")]
[System.ServiceModel.ServiceContractAttribute(Namespace="http://example.com", ConfigurationName="ServiceReference2.Example")]
[XmlSerializerFormat(Style = OperationFormatStyle.Document,
Use = OperationFormatUse.Literal)]
public interface ClonicoWSPortType
{
[System.ServiceModel.OperationContractAttribute(Action="urn:call3", ReplyAction="urn:call3Response")]
[System.ServiceModel.FaultContractAttribute(typeof(ServiceReference2.ClonicoWSException), Action="urn:call3AutosClonicoWSException", Name="AutosClonicoWSException")]
[return: System.ServiceModel.MessageParameterAttribute(Name="return")]
[XmlSerializerFormat(Style = OperationFormatStyle.Document,
Use = OperationFormatUse.Literal)]
System.Threading.Tasks.Task<string> call3Async(string xml);
}
If it has happened to someone else, I appreciate your help, I have tried to apply everything I have found and I have not been able to solve it, thank you very much!