Здравствуйте, Serginio1, Вы писали:
S>Здравствуйте, dsalodki, Вы писали:
S>https://social.msdn.microsoft.com/Forums/vstudio/en-US/1335bed0-113d-4650-a8fd-e390699ec946/service-that-handles-both-soap11-and-soap12-messages?forum=wcf
S>https://www.integrator.dk/2014/04/dynamically-generating-a-wcf-proxy-without-using-a-config-file/
S>https://stackoverflow.com/questions/38719318/convert-c-sharp-binding-object-based-on-the-system-servicemodel
не получается
var config = new BindingElementCollection();
config.Add(new TextMessageEncodingBindingElement(MessageVersion.Soap12WSAddressing10, Encoding.UTF8));
HttpTransportBindingElement element = new HttpTransportBindingElement();
element.MaxReceivedMessageSize = element.MaxBufferSize = 1048576;
element.AuthenticationScheme = AuthenticationSchemes.Basic;
config.Add(element);
var customBinding = new CustomBinding(config);
var endpoint = new EndpointAddress(new Uri(""));
InfoTaxerPortTypeClient client = new InfoTaxerPortTypeClient(customBinding, endpoint);
client.ClientCredentials.UserName.UserName = "";
client.ClientCredentials.UserName.Password = "";
Data result = await client.GetDataAsync(innSearch);
ProtocolException: The content type text/xml; charset=utf-8 of the response message does not match the content type of the binding (application/soap+xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 1024 bytes of the response were: '<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="
http://schemas.xmlsoap.org/wsdl/"
xmlns:soap12bind="
http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:soapbind="
http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="
http://localhost/InfoTaxer"
xmlns:xsd="
http://www.w3.org/2001/XMLSchema"
xmlns:xsd1="
http://v8.1c.ru/8.1/data/enterprise"
xmlns:xsd2="
http://v8.1c.ru/8.1/data/core"
xmlns:xsd3="
http://localhost/InfoTaxer"
xmlns:xsd4="
http://v8.1c.ru/8.1/data/enterprise/current-config"
name="InfoTaxer"
targetNamespace="
http://localhost/InfoTaxer">
<types>
<xs:schema xmlns:tns="
http://v8.1c.ru/8.1/data/core"
xmlns:xs="
http://www.w3.org/2001/XMLSchema"
targetNamespace="
http://v8.1c.ru/8.1/data/core"
attributeFormDefault="unqualified"
elementFormDefault="qualified">
<xs:simpleType name="AllowedLength">
<xs:restriction base="xs:string">
<xs:enumeration value="Fixed"/>
<xs:enumeration value="Variable"/>
</xs:restriction>
</xs:simpleT'.