【问题标题】:Using WSO2 ESB PassThrough Proxy on WebLogic (Spring) Web Service在 WebLogic (Spring) Web 服务上使用 WSO2 ESB 直通代理
【发布时间】:2014-05-10 18:00:49
【问题描述】:

我已经尝试过 PassThroughu 代理教程,并且所有的都适用于在 Axis (Apache CFX) 上部署目标 Web 服务的示例。在 WSO2 ESB 上使用“TryIt”很好地测试了源和代理 Web 服务。

现在不同了 - 我尝试使用非常简单的 Weblogic Spring Web 服务来实现相同的目标(我不相信使用 Spring 和自下而上的方法和注释很重要)。它部署在 WebLogic 服务器上(与 WSO2 ESB 在同一主机上运行)。不包括任何特殊的 WS-* 扩展。它几乎是 hello world web 服务。我可以轻松地对其进行测试 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 服务 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 生成的 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(保存和删除功能)以达到允许的帖子大小。
  • 尝试添加动作名称,但没有区别(保留没有它们的示例)

【问题讨论】:

标签: spring web weblogic wso2esb


【解决方案1】:

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

这种情况下的错误是The endpoint reference (EPR) for the Operation not found is...

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

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

或者,从 ESB 4.8 开始:

  • 在代理配置中添加此参数:&lt;parameter name="disableOperationValidation" locked="false"&gt;true&lt;/parameter&gt;

  • 修改存储库/conf/axis2 中的axis2.xml conf 替换

    &lt;handler class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher" name="SOAPMessageBodyBasedDispatcher"/&gt;

    &lt;handler class="org.apache.synapse.core.axis2.SynapseSOAPMessageBodyBasedDispatcher" name="SOAPMessageBodyBasedDispatcher"/&gt;

【讨论】:

  • 您回答的第一部分给了我提示。我通过@WebMethod(action="findAll") 明确添加了操作。必须在 WSO ESB 上执行 WebLogic“清理”并重新创建代理(这很奇怪)。然后一切正常。我没有找到方便的添加操作名称到端点,但感谢提示,很高兴知道更多选项。第二部分在我的情况下不起作用(如果我将操作名称保留为空白)。如果我可以补充的话,WSO ESB 需要更多实用示例、博客等。非常感谢您的回答。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-06-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-09-14
  • 1970-01-01
相关资源
最近更新 更多