The MtomMessageEncoderBindingElement
allows .NET Core applications to communicate with WCF endpoints which support MTOM encoding.
Note: This is not a complete implementation of MTOM. It is meant as a workaround for calling existing MTOM encoded SOAP services. It consumes MTOM encoded messages, but does not perform MTOMEncoding on outbound messages. However this should be sufficent for interoperating with existing services.
You need to install the WcfCoreMtomEncoder
Nuget Package: Install-Package WcfCoreMtomEncoder
.
And then create a custom binding:
var encoding = new MtomMessageEncoderBindingElement(new TextMessageEncodingBindingElement());
var transport = new HttpTransportBindingElement();
var customBinding = new CustomBinding(encoding, transport);
var client = new MtomEnabledServiceClient(customBinding);
For specific steps, you can refer to this link.