1

the data I send to a web service, gets there with some strange characters. so the web service developer asked me to add this code to the soap envelope:

 soap:encodingStyle=http://www.w3.org/2003/05/soap-encoding

I tried adding this code, but it did not work:

 MessageHeader aMessageHeader = 
MessageHeader.CreateHeader("encodingStyle", "http://tempuri.org", 
"2003/05/soap-encoding");                  
OperationContext.Current.OutgoingMessageHeaders.Add(aMessageHeader);

how do i add to the soap:envelope a encodingStyle attribute in c#?

Dvey
  • 161
  • 8

1 Answers1

0

I had the same issue as you reported. I found that this was a reported issue in the WCF. https://github.com/dotnet/wcf/issues/3870

For the fix, I updated the following NuGet packages in my project from version "4.4.*" to "4.7.0"

  • System.ServiceModel.Duplex
  • System.ServiceModel.Http
  • System.ServiceModel.NetTcp
  • System.ServiceModel.Security

It now includes the "encodingStyle" attribute in the correct location.

Carmon Colvin
  • 58
  • 1
  • 8