WSDL 生成的代码中 Envelope 中的 SOAP 版本

SOAP version in Envelope from code generated by WSDL

我正在使用 WSDL 生成的服务开发解决方案。当我调用该服务时,我收到错误请求错误。我启用了跟踪功能,发送的消息包含以下信封:

<s:Envelope xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:s="http://www.w3.org/2003/05/soap-envelope">

当我尝试使用 cURL 时,出现 "InputStream does not represent a valid SOAP 1.1 Message" 错误,当我将 xmlns:s 更改为使用 SOAP 版本 1.1 时,当然工作得很好。

在 WSDL 中绑定是:

<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />

根据我的发现,它是 SOAP 1.1。

如何修改 WSDL 或生成的代码以发送具有正确 SOAP 版本的消息?

只需在绑定中添加 textMessageEncoding

<customBinding>
    <binding name="wsHttpEndpointBinding">
      <textMessageEncoding messageVersion="Soap11" />