如何使用WSO2 ESB通过JMS将文本消息转换为SOAP有效负载

时间:2014-09-03 17:43:33

标签: wso2 esb

我正在使用WSO2 ESB通过JMS侦听MQ队列,然后将收到的多行文本消息转换为多个SOAP请求,但无法使其无错误地工作。

错误: TID:[0] [ESB] [2014-09-03 13:17:29,198]错误{org.apache.axis2.engine.AxisEngine} - 未找到操作的端点引用(EPR)和WSA操作=空值。如果以前可以访问此EPR,请与服务器管理员联系。 {} org.apache.axis2.engine.AxisEngine org.apache.axis2.AxisFault:未找到Operation的端点引用(EPR)是,WSA Action = null。如果以前可以访问此EPR,请与服务器管理员联系。     在org.apache.axis2.engine.DispatchPhase.checkPostConditions(DispatchPhase.java:102)

以下是我的代理配置供参考:

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://ws.apache.org/ns/synapse">
   <proxy name="StockQuoteJmsProxy"
      transports="jms"
      startOnLoad="true"
      trace="disable">
  <target>
     <inSequence>
        <smooks config-key="smooks-key">
           <input type="text"/>
           <output type="xml"/>
        </smooks>
        <xslt key="transform-xslt-key"/>
        <log level="full"/>
        <iterate xmlns:m0="http://services.samples"
                 preservePayload="true"
                 attachPath="//m0:placeOrder"
                 expression="//m0:placeOrder/m0:order">
           <target>
              <sequence>
                 <header name="Action" value="urn:placeOrder"/>
                 <property name="OUT_ONLY" value="true"/>
                 <send>
                    <endpoint>
                       <address uri="http://localhost:9000/services/SimpleStockQuoteService" format="soap11"/>
                    </endpoint>
                 </send>
              </sequence>
           </target>
        </iterate>
     </inSequence>
     <outSequence/>
  </target>
  <publishWSDL uri="file:repository/samples/resources/proxy/sample_proxy_1.wsdl"/>
  <parameter name="transport.jms.ContentType">
     <rules>
        <jmsProperty>contentType</jmsProperty>
        <default>text/plain</default>
     </rules>
  </parameter>
  <parameter name="transport.jms.ConnectionFactory">SQProxyCF</parameter>
   </proxy>
   <localEntry key="transform-xslt-key"
           src="file:repository/samples/resources/smooks/transform.xslt">
  <description/>
</localEntry>
   <localEntry key="smooks-key"
           src="file:repository/samples/resources/smooks/smooks-config.xml">
  <description/>
   </localEntry>
   <sequence name="fault">
  <log level="full">
     <property name="MESSAGE" value="Executing default 'fault' sequence"/>
     <property name="ERROR_CODE" expression="get-property('ERROR_CODE')"/>
     <property name="ERROR_MESSAGE" expression="get-property('ERROR_MESSAGE')"/>
  </log>
  <drop/>
   </sequence>
   <sequence name="main">
  <in>
     <log level="full"/>
     <filter source="get-property('To')" regex="http://localhost:9000.*">
        <send/>
     </filter>
  </in>
  <out>
     <send/>
  </out>
  <description>The main sequence for the message mediation</description>
   </sequence>
</definitions>

请帮助我在这种情况下没有正确完成的工作。非常感谢提前!

2 个答案:

答案 0 :(得分:0)

您可能需要在翻译之后但在之前定义文档类型。为此,您可以分配ContentType axis2属性:

<property name="ContentType" value="application/xml" scope="axis2"/>

如果这不起作用,附加一个完整的堆栈转储或wso2carbon.log将帮助我解决它。

谢谢, 科林

答案 1 :(得分:0)

对于那些感兴趣的人,这里是工作代理配置:

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://ws.apache.org/ns/synapse">
   <proxy name="TextToXmlProxy"
      transports="jms"
      startOnLoad="true"
      trace="disable">
  <target>
     <inSequence>
        <smooks config-key="smooks-key">
           <input type="text"/>
           <output type="xml"/>
        </smooks>
        <xslt key="transform-xslt-key"/>
        <log level="full"/>
        <iterate xmlns:m0="http://services.samples"
                 preservePayload="true"
                 attachPath="//m0:placeOrder"
                 expression="//m0:placeOrder/m0:order">
           <target>
              <sequence>
                 <header name="Action" value="urn:placeOrder"/>
                 <property name="OUT_ONLY" value="true"/>
                 <send>
                    <endpoint>
                       <address uri="http://localhost:9000/services/SimpleStockQuoteService"
                                format="soap11"/>
                    </endpoint>
                 </send>
              </sequence>
           </target>
        </iterate>
     </inSequence>
     <outSequence>
        <send/>
     </outSequence>
     <faultSequence/>
  </target>
  <parameter name="transport.jms.ContentType">
     <rules>
        <jmsProperty>contentType</jmsProperty>
        <default>text/plain</default>
     </rules>
  </parameter>
  <parameter name="transport.jms.ConnectionFactory">SQProxyCF</parameter>
   </proxy>
   <localEntry key="transform-xslt-key"
           src="file:repository/samples/resources/smooks/transform.xslt">
  <description/>
   </localEntry>
   <localEntry key="smooks-key"
           src="file:repository/samples/resources/smooks/smooks-config.xml">
  <description/>
   </localEntry>
   <sequence name="fault">
  <log level="full">
     <property name="MESSAGE" value="Executing default 'fault' sequence"/>
     <property name="ERROR_CODE" expression="get-property('ERROR_CODE')"/>
     <property name="ERROR_MESSAGE" expression="get-property('ERROR_MESSAGE')"/>
  </log>
  <drop/>
   </sequence>
   <sequence name="main">
  <in>
     <log level="full"/>
     <filter source="get-property('To')" regex="http://localhost:9000.*">
        <send/>
     </filter>
  </in>
  <out>
     <send/>
  </out>
  <description>The main sequence for the message mediation</description>
   </sequence>
</definitions>