Build SOAP request using generated proxy classes without xml tag or with encoding utf-8 instead of utf-16

220 Views Asked by At

I want to write request to soap service. I have wsdl file. Using svcutil I've generated proxy clasess for that request. In result of it, I request with correct parameters but the request contains xml tag on start of it with encoding utf-16.

<?xml version="1.0" encoding="utf-16"?>

Seems like this isn't supported by endpoint to which I'm doing request. So question - can I somehow change encoding or remove that xml tag at all?

I've found that XMLWriter has XmlWriterSettings.OmitXmlDeclaration. So when it is true, xml tag shouldn't appear in request. But don't know how to add/change XmlWriter for generated soap client.

when creating soap client I can only set Binding and endpoint

public outbClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : 
        base(binding, remoteAddress)
{
}
0

There are 0 best solutions below