Mulesoft中托管的.NET WSDL端点中的“信封命名空间是意外的”错误

时间:2016-09-20 08:32:48

标签: xml web-services soap wsdl mule

我们在Mule中托管了一个已从.NET ASMX Web服务定义文件迁移的端点。

命名空间的位置在.NET期望和Mule似乎从该WSDL实现的内容之间有所不同。

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

  

可能的SOAP版本不匹配:信封命名空间http://foo/bar/是   意外。期待http://schemas.xmlsoap.org/soap/envelope/

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>

虽然.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>

http://foo/bar命名空间附加到.NET中的消息正文中,我很确定当从.NET客户端向Mule托管端点发布消息时,这个冲突的实现会导致错误。

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

原始WSDL如下所示:

<?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>

0 个答案:

没有答案