在WebLogic(Spring)Web服务上使用WSO2 ESB PassThrough Proxy

时间:2014-05-10 18:00:49

标签: spring web weblogic wso2esb

我已经尝试过PassThroughu代理教程,并且所有工作都在构建示例中,其中Target Web Service部署在Axis(Apache CFX)上。源代理和代理Web服务很好地使用" TryIt"在WSO2 ESB上。

现在不同的故事 - 我尝试使用非常简单的Weblogic Spring Web Service实现相同的目标(我不相信Spring的使用和自下而上的方法和注释很重要)。它部署在WebLogic服务器上(与WSO2 ESB在同一主机上运行)。没有任何特殊的WS- *扩展名。它几乎是世界上的网络服务。我可以轻松地测试它SoapUi,UniversalTestClient(WebLogic)并在浏览器中查看WSDL。

关于生成的代理PassThrough Web服务(遵循教程中的相同步骤),我还可以看到生成的WSDL:

http://localhost:8280/services/WebServiceAServicePassThroughProxy?wsdl

然而,SoapUI和TryIt都不起作用并且都返回FaultString:

The endpoint reference (EPR) for the Operation not found is /services/WebServiceAServicePassThroughProxy.WebServiceAServicePassThroughProxyHttpSoap11Endpoint and the WSA Action = . If this EPR was previously reachable, please contact the server administrator.

这是我用来测试的功能" findContactById":

 <body>
   <p:findContactById xmlns:p="http://webservicea.testtoold.xx.yy.zz.eu/">
      <!--Exactly 1 occurrence-->
      <arg0>1</arg0>
   </p:findContactById>
</body>

在代理Web服务上运行。我尝试了在代理Web服务中生成的所有端点,错误与上面相同,除非我从下拉列表中尝试httpEndpoint:

http://localhost:8280/services/WebServiceAServicePassThroughProxy.WebServiceAServicePassThroughProxyHttpEndpoint 

然后我得到不支持的媒体类型为TryItProxyError。

任何人请帮助,我对此感到疯狂......应该是简单的,而不是噩梦。搜索所有网络我看到几个类似的问题没有答案。

WebLogic Service WSDL:

<?xml version='1.0' encoding='UTF-8'?><!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2.8-b13937 svn-revision#13942. --><!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2.8-b13937 svn-revision#13942. --><definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://webservicea.testtoold.xx.yy.zz.eu/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://webservicea.testtoold.xx.yy.zz.eu/" name="WebServiceAService">
<types>
  <xsd:schema>
    <xsd:import namespace="http://webservicea.testtoold.xx.yy.zz.eu/" schemaLocation="http://localhost:7001/TestToolD/WebServiceAService?xsd=1"/>
  </xsd:schema>
</types>
<message name="findContactById">
  <part name="parameters" element="tns:findContactById"/>
</message>
<message name="findContactByIdResponse">
  <part name="parameters" element="tns:findContactByIdResponse"/>
</message>
<message name="Exception">
  <part name="fault" element="tns:Exception"/>
</message>
<message name="findAllContacts">
  <part name="parameters" element="tns:findAllContacts"/>
</message>
<message name="findAllContactsResponse">
  <part name="parameters" element="tns:findAllContactsResponse"/>
</message>
<portType name="WebServiceA">
  <operation name="findContactById">
    <input wsam:Action="http://webservicea.testtoold.xx.yy.zz.eu/WebServiceA/findContactByIdRequest" message="tns:findContactById"/>
    <output wsam:Action="http://webservicea.testtoold.xx.yy.zz.eu/WebServiceA/findContactByIdResponse" message="tns:findContactByIdResponse"/>
    <fault message="tns:Exception" name="Exception" wsam:Action="http://webservicea.testtoold.xx.yy.zz.eu/WebServiceA/findContactById/Fault/Exception"/>
  </operation>
  <operation name="findAllContacts">
    <input wsam:Action="http://webservicea.testtoold.xx.yy.zz.eu/WebServiceA/findAllContactsRequest" message="tns:findAllContacts"/>
    <output wsam:Action="http://webservicea.testtoold.xx.yy.zz.eu/WebServiceA/findAllContactsResponse" message="tns:findAllContactsResponse"/>
    <fault message="tns:Exception" name="Exception" wsam:Action="http://webservicea.testtoold.xx.yy.zz.eu/WebServiceA/findAllContacts/Fault/Exception"/>
  </operation>
</portType>
<binding name="WebServiceAPortBinding" type="tns:WebServiceA">
  <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
  <operation name="findContactById">
    <soap:operation soapAction=""/>
    <input>
      <soap:body use="literal"/>
    </input>
    <output>
      <soap:body use="literal"/>
    </output>
    <fault name="Exception">
      <soap:fault name="Exception" use="literal"/>
    </fault>
  </operation>
  <operation name="findAllContacts">
    <soap:operation soapAction=""/>
    <input>
      <soap:body use="literal"/>
    </input>
    <output>
      <soap:body use="literal"/>
    </output>
    <fault name="Exception">
      <soap:fault name="Exception" use="literal"/>
    </fault>
  </operation>
</binding>
<service name="WebServiceAService">
  <port name="WebServiceAPort" binding="tns:WebServiceAPortBinding">
    <soap:address location="http://localhost:7001/TestToolD/WebServiceAService"/>
  </port>
</service>
</definitions>

WSO ESB Generated PassThroughProxy.wsdl

<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:tns="http://webservicea.testtoold.xx.yy.zz.eu/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://webservicea.testtoold.xx.yy.zz.eu/">
   <wsdl:types>
      <xsd:schema attributeFormDefault="unqualified" elementFormDefault="unqualified">
         <xsd:import namespace="http://webservicea.testtoold.xx.yy.zz.eu/" schemaLocation="WebServiceAServicePassThroughProxy?xsd=http://localhost:7001/TestToolD/WebServiceAService?xsd=1.xsd"></xsd:import>
      </xsd:schema>
   </wsdl:types>
   <wsdl:message name="findContactById">
      <wsdl:part name="parameters" element="tns:findContactById"></wsdl:part>
   </wsdl:message>
   <wsdl:message name="findContactByIdResponse">
      <wsdl:part name="parameters" element="tns:findContactByIdResponse"></wsdl:part>
   </wsdl:message>
   <wsdl:message name="findAllContacts">
      <wsdl:part name="parameters" element="tns:findAllContacts"></wsdl:part>
   </wsdl:message>
   <wsdl:message name="findAllContactsResponse">
      <wsdl:part name="parameters" element="tns:findAllContactsResponse"></wsdl:part>
   </wsdl:message>
   <wsdl:portType name="WebServiceAServicePassThroughProxyPortType">
      <wsdl:operation name="findContactById">
         <wsdl:input message="tns:findContactById"></wsdl:input>
         <wsdl:output message="tns:findContactByIdResponse" wsaw:Action="http://webservicea.testtoold.xx.yy.zz.eu/WebServiceA/findContactByIdResponse"></wsdl:output>
         <wsdl:fault message="tns:Exception" name="Exception" wsaw:Action="http://webservicea.testtoold.xx.yy.zz.eu/WebServiceA/findContactById/Fault/Exception"></wsdl:fault>
      </wsdl:operation>
      <wsdl:operation name="findAllContacts">
         <wsdl:input message="tns:findAllContacts"></wsdl:input>
         <wsdl:output message="tns:findAllContactsResponse" wsaw:Action="http://webservicea.testtoold.xx.yy.zz.eu/WebServiceA/findAllContactsResponse"></wsdl:output>
         <wsdl:fault message="tns:Exception" name="Exception" wsaw:Action="http://webservicea.testtoold.xx.yy.zz.eu/WebServiceA/findAllContacts/Fault/Exception"></wsdl:fault>
      </wsdl:operation>
   </wsdl:portType>
   <wsdl:binding name="WebServiceAServicePassThroughProxySoap11Binding" type="tns:WebServiceAServicePassThroughProxyPortType">
      <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"></soap:binding>
      <wsdl:operation name="findContactById">
         <soap:operation soapAction="" 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:fault name="Exception">
            <soap:fault use="literal" name="Exception"></soap:fault>
         </wsdl:fault>
      </wsdl:operation>
      <wsdl:operation name="findAllContacts">
         <soap:operation soapAction="" 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:fault name="Exception">
            <soap:fault use="literal" name="Exception"></soap:fault>
         </wsdl:fault>
      </wsdl:operation>
   </wsdl:binding>
   <wsdl:binding name="WebServiceAServicePassThroughProxySoap12Binding" type="tns:WebServiceAServicePassThroughProxyPortType">
      <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"></soap12:binding>
      <wsdl:operation name="findContactById">
         <soap12:operation soapAction="" 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:fault name="Exception">
            <soap12:fault use="literal" name="Exception"></soap12:fault>
         </wsdl:fault>
      </wsdl:operation>
      <wsdl:operation name="findAllContacts">
         <soap12:operation soapAction="" 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:fault name="Exception">
            <soap12:fault use="literal" name="Exception"></soap12:fault>
         </wsdl:fault>
      </wsdl:operation>
   </wsdl:binding>
   <wsdl:binding name="WebServiceAServicePassThroughProxyHttpBinding" type="tns:WebServiceAServicePassThroughProxyPortType">
      <http:binding verb="POST"></http:binding>
      <wsdl:operation name="findContactById">
         <http:operation location="findContactById"></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:operation name="findAllContacts">
         <http:operation location="findAllContacts"></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="WebServiceAServicePassThroughProxy">
      <wsdl:port name="WebServiceAServicePassThroughProxyHttpsSoap11Endpoint" binding="tns:WebServiceAServicePassThroughProxySoap11Binding">
         <soap:address location="https://supercomputer:8243/services/WebServiceAServicePassThroughProxy.WebServiceAServicePassThroughProxyHttpsSoap11Endpoint"></soap:address>
      </wsdl:port>
      <wsdl:port name="WebServiceAServicePassThroughProxyHttpSoap11Endpoint" binding="tns:WebServiceAServicePassThroughProxySoap11Binding">
         <soap:address location="http://supercomputer:8280/services/WebServiceAServicePassThroughProxy.WebServiceAServicePassThroughProxyHttpSoap11Endpoint"></soap:address>
      </wsdl:port>
      <wsdl:port name="WebServiceAServicePassThroughProxyHttpSoap12Endpoint" binding="tns:WebServiceAServicePassThroughProxySoap12Binding">
         <soap12:address location="http://supercomputer:8280/services/WebServiceAServicePassThroughProxy.WebServiceAServicePassThroughProxyHttpSoap12Endpoint"></soap12:address>
      </wsdl:port>
      <wsdl:port name="WebServiceAServicePassThroughProxyHttpsSoap12Endpoint" binding="tns:WebServiceAServicePassThroughProxySoap12Binding">
         <soap12:address location="https://supercomputer:8243/services/WebServiceAServicePassThroughProxy.WebServiceAServicePassThroughProxyHttpsSoap12Endpoint"></soap12:address>
      </wsdl:port>
      <wsdl:port name="WebServiceAServicePassThroughProxyHttpsEndpoint" binding="tns:WebServiceAServicePassThroughProxyHttpBinding">
         <http:address location="https://supercomputer:8243/services/WebServiceAServicePassThroughProxy.WebServiceAServicePassThroughProxyHttpsEndpoint"></http:address>
      </wsdl:port>
      <wsdl:port name="WebServiceAServicePassThroughProxyHttpEndpoint" binding="tns:WebServiceAServicePassThroughProxyHttpBinding">
         <http:address location="http://supercomputer:8280/services/WebServiceAServicePassThroughProxy.WebServiceAServicePassThroughProxyHttpEndpoint"></http:address>
      </wsdl:port>
   </wsdl:service>
</wsdl:definitions>

几点小话:

  • 本地主机和超级计算机之间的差异可能不是原因 - 教程可以很好地处理这种差异
  • 我尝试了很多东西(在注册表中创建端点,或者在本地创建端点,或者在创建代理时提供WSDL等等,但我总是得到相同的错误。)
  • 我已经删除了30%的代码行来简化WSDL(保存和删除功能)以达到允许的帖子大小。
  • 尝试添加动作名称,但没有区别(保留不带它们的示例)

1 个答案:

答案 0 :(得分:1)

自ESB 4.6起,默认情况下启用了直通传输:消息体不构建,因此不支持基于SOAP Body的调度(不能使用SOAP body元素的第一个子节点来确定操作)。

本案例中的错误为The endpoint reference (EPR) for the Operation not found is...

在您的情况下,您不能使用SOAPAction(它是空白的),但您可以:

  • 将操作名称附加到端点URL

或者,因为ESB 4.8:

  • 在代理配置文件中添加此参数:<parameter name="disableOperationValidation" locked="false">true</parameter>

  • 修改repository / conf / axis2中的axis2.xml conf替换

    <handler class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher" name="SOAPMessageBodyBasedDispatcher"/>

    <handler class="org.apache.synapse.core.axis2.SynapseSOAPMessageBodyBasedDispatcher" name="SOAPMessageBodyBasedDispatcher"/>