如何将两个wsdl合并到一个wsdl文件中?

问题描述 投票:0回答:2

我在 WSO2 ESB 中创建了一个代理,并在其中使用了两个不同的端点。然后我想发布一个通用的wsdl。我有来自两个不同 Web 服务的两个 wsdl 地址。

1- http://localhost:12080/SRV-CSB-MOCK/CsbService?wsdl

<?xml version="1.0" ?><wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://csb.sgrs.ayesas.com/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" name="CsbService" targetNamespace="http://csb.sgrs.ayesas.com/">
  <wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://csb.sgrs.ayesas.com/" elementFormDefault="unqualified" targetNamespace="http://csb.sgrs.ayesas.com/" version="1.0">

  <xs:element name="carpma" type="tns:carpma"></xs:element>

  <xs:element name="carpmaResponse" type="tns:carpmaResponse"></xs:element>

  <xs:complexType name="carpma">
    <xs:sequence>
      <xs:element name="ilk" type="xs:int"></xs:element>
      <xs:element name="son" type="xs:int"></xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="carpmaResponse">
    <xs:sequence>
      <xs:element name="return" type="xs:int"></xs:element>
    </xs:sequence>
  </xs:complexType>

</xs:schema>
  </wsdl:types>
  <wsdl:message name="carpma">
    <wsdl:part element="tns:carpma" name="parameters">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="carpmaResponse">
    <wsdl:part element="tns:carpmaResponse" name="parameters">
    </wsdl:part>
  </wsdl:message>
  <wsdl:portType name="CsbService">
    <wsdl:operation name="carpma">
      <wsdl:input message="tns:carpma" name="carpma">
    </wsdl:input>
      <wsdl:output message="tns:carpmaResponse" name="carpmaResponse">
    </wsdl:output>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="CsbServiceSoapBinding" type="tns:CsbService">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"></soap:binding>
    <wsdl:operation name="carpma">
      <soap:operation soapAction="carpma" style="document"></soap:operation>
      <wsdl:input name="carpma">
        <soap:body use="literal"></soap:body>
      </wsdl:input>
      <wsdl:output name="carpmaResponse">
        <soap:body use="literal"></soap:body>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="CsbService">
    <wsdl:port binding="tns:CsbServiceSoapBinding" name="CsbServicePort">
      <soap:address location="http://localhost:12080/SRV-CSB-MOCK/CsbService"></soap:address>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

2- http://localhost:12080/SRV_DBS_MOCK/MockGTHBService/MockGTHBService?wsdl

<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:tns="http://gthb.dbs.ayesas.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://gthb.dbs.ayesas.com/">
   <wsdl:types>
      <xsd:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://gthb.dbs.ayesas.com/" version="1.0">
         <xsd:element name="add" type="tns:add"></xsd:element>
         <xsd:element name="addResponse" type="tns:addResponse"></xsd:element>
         <xsd:complexType name="add">
            <xsd:sequence>
               <xsd:element name="x" type="xsd:int"></xsd:element>
               <xsd:element name="y" type="xsd:int"></xsd:element>
            </xsd:sequence>
         </xsd:complexType>
         <xsd:complexType name="addResponse">
            <xsd:sequence>
               <xsd:element name="return" type="xsd:int"></xsd:element>
            </xsd:sequence>
         </xsd:complexType>
      </xsd:schema>
   </wsdl:types>
   <wsdl:message name="add">
      <wsdl:part name="parameters" element="tns:add"></wsdl:part>
   </wsdl:message>
   <wsdl:message name="addResponse">
      <wsdl:part name="parameters" element="tns:addResponse"></wsdl:part>
   </wsdl:message>
   <wsdl:portType name="GTHBProxyPortType">
      <wsdl:operation name="add">
         <wsdl:input message="tns:add" wsaw:Action="add"></wsdl:input>
         <wsdl:output message="tns:addResponse" wsaw:Action="http://gthb.dbs.ayesas.com/MockGTHBService/addResponse"></wsdl:output>
      </wsdl:operation>
   </wsdl:portType>
   <wsdl:binding name="GTHBProxySoap11Binding" type="tns:GTHBProxyPortType">
      <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"></soap:binding>
      <wsdl:operation name="add">
         <soap:operation soapAction="add" style="document"></soap:operation>
         <wsdl:input>
            <soap:body use="literal"></soap:body>
         </wsdl:input>
         <wsdl:output>
            <soap:body use="literal"></soap:body>
         </wsdl:output>
      </wsdl:operation>
   </wsdl:binding>
   <wsdl:binding name="GTHBProxySoap12Binding" type="tns:GTHBProxyPortType">
      <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"></soap12:binding>
      <wsdl:operation name="add">
         <soap12:operation soapAction="add" style="document"></soap12:operation>
         <wsdl:input>
            <soap12:body use="literal"></soap12:body>
         </wsdl:input>
         <wsdl:output>
            <soap12:body use="literal"></soap12:body>
         </wsdl:output>
      </wsdl:operation>
   </wsdl:binding>
   <wsdl:binding name="GTHBProxyHttpBinding" type="tns:GTHBProxyPortType">
      <http:binding verb="POST"></http:binding>
      <wsdl:operation name="add">
         <http:operation location="add"></http:operation>
         <wsdl:input>
            <mime:content type="text/xml" part="parameters"></mime:content>
         </wsdl:input>
         <wsdl:output>
            <mime:content type="text/xml" part="parameters"></mime:content>
         </wsdl:output>
      </wsdl:operation>
   </wsdl:binding>
   <wsdl:service name="GTHBProxy">
      <wsdl:port name="GTHBProxyHttpSoap11Endpoint" binding="tns:GTHBProxySoap11Binding">
         <soap:address location="http://localhost.localdomain:8280/services/GTHBProxy.GTHBProxyHttpSoap11Endpoint"></soap:address>
      </wsdl:port>
      <wsdl:port name="GTHBProxyHttpsSoap11Endpoint" binding="tns:GTHBProxySoap11Binding">
         <soap:address location="https://localhost.localdomain:8243/services/GTHBProxy.GTHBProxyHttpsSoap11Endpoint"></soap:address>
      </wsdl:port>
      <wsdl:port name="GTHBProxyHttpsSoap12Endpoint" binding="tns:GTHBProxySoap12Binding">
         <soap12:address location="https://localhost.localdomain:8243/services/GTHBProxy.GTHBProxyHttpsSoap12Endpoint"></soap12:address>
      </wsdl:port>
      <wsdl:port name="GTHBProxyHttpSoap12Endpoint" binding="tns:GTHBProxySoap12Binding">
         <soap12:address location="http://localhost.localdomain:8280/services/GTHBProxy.GTHBProxyHttpSoap12Endpoint"></soap12:address>
      </wsdl:port>
      <wsdl:port name="GTHBProxyHttpsEndpoint" binding="tns:GTHBProxyHttpBinding">
         <http:address location="https://localhost.localdomain:8243/services/GTHBProxy.GTHBProxyHttpsEndpoint"></http:address>
      </wsdl:port>
      <wsdl:port name="GTHBProxyHttpEndpoint" binding="tns:GTHBProxyHttpBinding">
         <http:address location="http://localhost.localdomain:8280/services/GTHBProxy.GTHBProxyHttpEndpoint"></http:address>
      </wsdl:port>
   </wsdl:service>
</wsdl:definitions>

我想将它们合并到一个 wsdl 文件中。我将第二个 wsdl 的模式和方法添加到第一个 wsdl 中。但我无法更改定义中的 targetNamespace="http://csb.sgrs.ayesas.com/" 。所以我无法访问第二个 wsdl 中的其他方法。

namespaces wsdl wso2 esb wso2-esb
2个回答
0
投票

以下是 StackOverflow 上的类似问题,可能会有所帮助:

将多个 wsdl 和 xsd 文件...合并为一个 wsdl

使用 WsO2 有时,拥有两个单独的端点,然后创建一个服务来调用这两个端点,然后使用 XSLT 转换或任何适合您的业务用例的正确操作将两个结果混合在一起会更容易。

但是,当您需要一个服务调用两个不同的端点时,您可以选择通过创建适用于这两个端点的命名空间来创建代表这两个端点的 WSDL。

如果您手动创建 WSDL,请考虑以下几点:

确保两个WSDL文件的目标命名空间相同。如果不是,您将需要更新其中一个文件中的命名空间以匹配另一个文件。 IE:两个调用都需要有一个唯一的名称。

检查两个 WSDL 文件中是否存在重复的元素或类型定义并将其删除。

检查两个 WSDL 文件中的元素、类型和操作之间是否存在命名冲突并解决它们。

确保两个 WSDL 文件中所有导入和包含的文件也被合并,并且它们的引用也相应更新。

验证合并的 WSDL 文件以确保其语法和语义正确。

使用 SOAP 客户端测试合并的 WSDL 文件,以确保其按预期工作。


0
投票

Niste,ayesas'ın url bilgisini açıkça vermişsiniz。 Açıkça güvenlikriski içeriyor bu。 Bence bu konuda daha dikkatli olmalısınız diyeceğim ama aradan geçen 9 yılın ardından Herhalde bu konudaki farkındalığınız artmıştır çoktan.

© www.soinside.com 2019 - 2024. All rights reserved.