Xml &引用;信封名称空间是意外的";Mulesoft中承载的.NET WSDL终结点出错

Xml &引用;信封名称空间是意外的";Mulesoft中承载的.NET WSDL终结点出错,xml,web-services,soap,wsdl,mule,Xml,Web Services,Soap,Wsdl,Mule,我们在Mule中托管了一个端点,该端点是从.NET ASMX web服务定义文件迁移而来的 名称空间的位置在.NET所期望的和Mule从WSDL实现的名称空间之间是不同的 来自连接到终结点的.NET客户端的错误如下所示: 可能的SOAP版本不匹配:信封命名空间不匹配 想不到的期待 Mule期望的SOAP信封如下所示: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:foo="http:/

我们在Mule中托管了一个端点,该端点是从.NET ASMX web服务定义文件迁移而来的

名称空间的位置在.NET所期望的和Mule从WSDL实现的名称空间之间是不同的

来自连接到终结点的.NET客户端的错误如下所示:

可能的SOAP版本不匹配:信封命名空间不匹配 想不到的期待

Mule期望的SOAP信封如下所示:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:foo="http://foo/bar/">
    <soap:Body>
        <foo:DoSomething>
            <foo:xmlDocument>
            </foo:xmlDocument>
        </foo:DoSomething>
    </soap:Body>
</soap:Envelope>
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://foo/bar/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://foo/bar/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
  <wsdl:types>
    <s:schema elementFormDefault="qualified" targetNamespace="http://foo/bar/">
      <s:element name="DoSomething">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="xmlDocument" type="s:string" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="DoSomethingResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="1" maxOccurs="1" name="DoSomethingResult" type="s:int" />
          </s:sequence>
        </s:complexType>
      </s:element>
    </s:schema>
  </wsdl:types>
  <wsdl:message name="DoSomethingSoapIn">
    <wsdl:part name="parameters" element="tns:DoSomething" />
  </wsdl:message>
  <wsdl:message name="DoSomethingSoapOut">
    <wsdl:part name="parameters" element="tns:DoSomethingResponse" />
  </wsdl:message>
  <wsdl:portType name="DoSomethingInboundSoap">
    <wsdl:operation name="DoSomething">
      <wsdl:input message="tns:DoSomethingSoapIn" />
      <wsdl:output message="tns:DoSomethingSoapOut" />
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="DoSomethingInboundSoap" type="tns:DoSomethingInboundSoap">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
    <wsdl:operation name="DoSomething">
      <soap:operation soapAction="http://foo/bar/DoSomething" style="document" />
      <wsdl:input>
        <soap:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:binding name="DoSomethingInboundSoap12" type="tns:DoSomethingInboundSoap">
    <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
    <wsdl:operation name="DoSomething">
      <soap12:operation soapAction="http://foo/bar/DoSomething" style="document" />
      <wsdl:input>
        <soap12:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap12:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="DoSomethingInbound">
    <wsdl:port name="DoSomethingInboundSoap" binding="tns:DoSomethingInboundSoap">
      <soap:address location="http://foo/bar/DoSomethingInbound.asmx" />
    </wsdl:port>
    <wsdl:port name="DoSomethingInboundSoap12" binding="tns:DoSomethingInboundSoap12">
      <soap12:address location="http://foo/bar/DoSomethingInbound.asmx" />
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

而.NET中承载的WSDL将WSDL转换为:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Body>
      <DoSomething xmlns="http://foo/bar/">
        <xmlDocument></xmlDocument>
      </DoSomething>
    </soap:Body>
</soap:Envelope>

名称空间被附加到.NET中的消息体,我确信当消息从.NET客户端发布到Mule承载的端点时,这个冲突的实现会导致错误

我无法更改.NET客户端。这是第三方调用此服务,我对此没有影响。我需要修改Mule端点,以便它在当前发送这些消息时接受这些消息

原始WSDL如下所示:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:foo="http://foo/bar/">
    <soap:Body>
        <foo:DoSomething>
            <foo:xmlDocument>
            </foo:xmlDocument>
        </foo:DoSomething>
    </soap:Body>
</soap:Envelope>
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://foo/bar/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://foo/bar/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
  <wsdl:types>
    <s:schema elementFormDefault="qualified" targetNamespace="http://foo/bar/">
      <s:element name="DoSomething">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="xmlDocument" type="s:string" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="DoSomethingResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="1" maxOccurs="1" name="DoSomethingResult" type="s:int" />
          </s:sequence>
        </s:complexType>
      </s:element>
    </s:schema>
  </wsdl:types>
  <wsdl:message name="DoSomethingSoapIn">
    <wsdl:part name="parameters" element="tns:DoSomething" />
  </wsdl:message>
  <wsdl:message name="DoSomethingSoapOut">
    <wsdl:part name="parameters" element="tns:DoSomethingResponse" />
  </wsdl:message>
  <wsdl:portType name="DoSomethingInboundSoap">
    <wsdl:operation name="DoSomething">
      <wsdl:input message="tns:DoSomethingSoapIn" />
      <wsdl:output message="tns:DoSomethingSoapOut" />
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="DoSomethingInboundSoap" type="tns:DoSomethingInboundSoap">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
    <wsdl:operation name="DoSomething">
      <soap:operation soapAction="http://foo/bar/DoSomething" style="document" />
      <wsdl:input>
        <soap:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:binding name="DoSomethingInboundSoap12" type="tns:DoSomethingInboundSoap">
    <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
    <wsdl:operation name="DoSomething">
      <soap12:operation soapAction="http://foo/bar/DoSomething" style="document" />
      <wsdl:input>
        <soap12:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap12:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="DoSomethingInbound">
    <wsdl:port name="DoSomethingInboundSoap" binding="tns:DoSomethingInboundSoap">
      <soap:address location="http://foo/bar/DoSomethingInbound.asmx" />
    </wsdl:port>
    <wsdl:port name="DoSomethingInboundSoap12" binding="tns:DoSomethingInboundSoap12">
      <soap12:address location="http://foo/bar/DoSomethingInbound.asmx" />
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>


您不能更改客户端,但可以更改WSDL,对吗?另外,您需要同时支持SOAP1.1和1.2吗?我确实可以修改Mule中承载的WSDL。理想情况下,应该支持两个SOAP版本。从您提供的wsdl生成实例如何:根据经验:使用
wsimport
生成存根。不要使用xjc。@Rebecca我在web API项目中集成SAP web服务时遇到了这个问题。错误:
可能的SOAP版本不匹配:信封命名空间http://schemas.xmlsoap.org/wsdl/ 这是出乎意料的。期望http://schemas.xmlsoap.org/soap/envelope/.
i我是新来的!