2017-04-26 53 views
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的客户端没有,但是这会是方式更多的工作...

回答

0

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

相关问题