如何为customBinding指定ContentType?

How to specify ContentType for customBinding?

在我的 App.config 中,我有这个绑定:

        <customBinding>
            <binding name="B2BJSONSoap12">
                <textMessageEncoding messageVersion="Soap12" />
                <httpsTransport />
            </binding>
        </customBinding>

它的终点是:

        <endpoint address="https://xxx.xxx.xxx/b2bJSON.asmx"
            binding="customBinding" bindingConfiguration="B2BJSONSoap12"
            contract="SROCS.B2BJSONSoap" name="B2BJSONSoap12" />

在代码中,我创建了 B2BJSONSoapClient(由 wsdl 加载)用于调用方法。当我尝试调用一个时,我得到 System.ServiceModel.ProtocolException(俄语)whish someting like that:

Content type text/html; Charset=utf-8 of the response message does not match the content type of the binding (application/soap+xml; charset=utf-8). When using a special encoder, you need to implement the IsContentTypeSupported method correctly.

那么如何将内容类型指定为 "application/soap+xml"?

我可以在没有客户端的情况下使用 HttpWebRequest 来做到这一点,但那样工作会更多...

所以问题是用户名和密码不正确,我不知道为什么服务给了我这个例外。它现在可以使用相同的设置。