0
在我的App.config我有這樣的結合:如何爲customBinding指定ContentType?
<customBinding>
<binding name="B2BJSONSoap12">
<textMessageEncoding messageVersion="Soap12" />
<httpsTransport />
</binding>
</customBinding>
這endpount吧:
<endpoint address="https://xxx.xxx.xxx/b2bJSON.asmx"
binding="customBinding" bindingConfiguration="B2BJSONSoap12"
contract="SROCS.B2BJSONSoap" name="B2BJSONSoap12" />
在代碼中,我創建B2BJSONSoapClient(這是由WSDL加載)的調用方法。當我嘗試調用一個時,我得到System.ServiceModel.ProtocolException(俄語)whish說這樣的:
內容類型text/html;響應消息的Charset = utf-8與綁定的內容類型(application/soap + xml; charset = utf-8)不匹配。使用特殊編碼器時,需要正確實施IsContentTypeSupported方法。
那麼如何指定內容類型爲「application/soap + xml」?
我能做到這一點使用HttpWebRequest的客戶端沒有,但是這會是方式更多的工作...