Vaibhav Verma
Vaibhav Verma

Reputation: 67

Set TextMessageEncoding-message version in wsHttpBinding

I am trying to call SOAP1.2 service using wsHttpBinding. The service accepts rejects the default Soap12WSAddressing10 message version. It only accepts SOAP12.

One suggestion I could get from the Internet search was to create the TextMessageEncodingElement in a custom binding.

How can it be either be accomplished using code or configuration ?

WSHttpBinding myBinding = new WSHttpBinding();   
myBinding.Security.Mode = SecurityMode.Transport;            
myBinding.Security.Transport.ClientCredentialType = 
HttpClientCredentialType.Certificate;
//MessageVersion = SOAP12

On using the custom wsBinding as well, there is no suggested placeholder to specify the message version.

<wsHttpBinding>       
<binding name="customWS">          
<security mode="Transport">
<message clientCredentialType="Certificate"></message>            
</security>          
</binding>
</wsHttpBinding>

Upvotes: 0

Views: 1924

Answers (2)

ertugrulakdag
ertugrulakdag

Reputation: 95

CustomBinding customBinding = new CustomBinding();
SoapTools.CustomEncodingBindingElement customEncodingBindingElement = new SoapTools.CustomEncodingBindingElement();
customEncodingBindingElement.MessageVersion = MessageVersion.CreateVersion(EnvelopeVersion.Soap12,AddressingVersion.None);

Upvotes: 0

Thom Kiesewetter
Thom Kiesewetter

Reputation: 7334

Soap12 specify the soapaction by content-type header. I think it is not implemented in net core. I use the following code.

var encoding = new TextMessageEncodingBindingElement(MessageVersion.CreateVersion(EnvelopeVersion.Soap12, AddressingVersion.None), Encoding.UTF8);

But this is not implemented in net core.

Upvotes: 2

Related Questions