我尝试向服务器发送SOAP1.2请求并收到以下异常
System.ServiceModel.CommunicationException:传入消息的信封版本(Soap11(http://schemas.xmlsoap.org/soap/envelope/))与编码器的信封版本不匹配(Soap12(http://www.w3) .ORG / 2003/05 / SOAP信封)) . 确保使用与预期消息相同的版本配置绑定 .
我再次尝试使用SOAP 1.1向同一服务器发送消息并获得以下异常
System.ServiceModel.ProtocolException:响应消息的内容类型application / soap xml与绑定的内容类型(text / xml; charset = utf-8)不匹配 . 如果使用自定义编码器,请确保正确实现IsContentTypeSupported方法 .
基于以上2个日志,我可以得出结论远程服务器正在使用SOAP1.1并使用为SOAP1.2定义的内容类型发送响应,即application / soap xml?它是SOAP规范的正确实现吗?
代码是使用WSDL的服务引用生成的 . 以下是代码段:
Test3.ServiceReference1.SoapRqst client = new Test3.ServiceReference1.SoapRqstClient();
RepRequest rqst = new RepRequest();
RepResponse op = client.getReply(rqst);
string responseSting = op.Body.respMsg;
Console.Out.Write(responseSting);
客户端服务模型:
服务绑定对于SOAP 1.1
binding="basicHttpBinding" bindingConfiguration="<>"
contract="<>" name="<>" />
SOAP 1.2的服务绑定
binding="customBinding" bindingConfiguration="<>"
contract="<>" name="<>" />