2015-06-19 162 views
0

我有JMS消息處理JMS在ESB WSO2消息

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> 
 
<content> 
 
    <entry type="1"> 
 
     <textMessage JMSDeliveryMode="2" JMSDestination="queue:///QUEUE" JMSExpiration="0" JMSMessageID="ID:c3e2d840d8e3c1f14040404040404040cf1eba01c4eff036" JMSPriority="4" JMSRedelivered="false" JMSTimestamp="1434705226223" fromQueue="true" codec="Base64"> 
 
      <text>dGVzdA==</text> 
 
     </textMessage> 
 
    </entry> 
 
</content>

但是當我把它變成WSO2 ESB它進入SOAP信封,我不能夠檢索在這裏的屬性,如JMSDestination等
我想讀取WSO2 ESB中的這些細節。有沒有辦法? 從JMS獲取消息後,我得到以下SOAP消息,並且正在進行日誌記錄,或者xPath僅在此消息中起作用。

[2015-06-22 11:08:33,632] INFO - LogMediator To: , WSAction: urn:mediate, SOAPA 
 
ction: urn:mediate, MessageID: ID:c3e2d840d8e3c1f14040404040404040cf224f7f3bbf47 
 
25, Direction: request, Envelope: <?xml version="1.0" encoding="utf-8"?><soapenv 
 
:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Bod 
 
y>test1</soapenv:Body></soapenv:Envelope>

感謝

+0

你能告訴我們你從隊列中讀取的wso2代理嗎?然後你可以用這樣的XPath表達式訪問你的元素:'' – FiveO

回答

0

我在我的發送代理設置JMS標頭這樣。

在接收代理,然後你可以使用get屬性訪問屬性類似下面的例子。

<log level="custom"> 
     <property name="Autodeploy_TSONL_CreateProxyTarget - Config Params transport intervall " 
        expression="get-property('transport','TRANSPORT_TRANSFERINTERVALL')"/> 

希望有所幫助。

+0

不知何故設置標題的來源沒有顯示在我的答案。希望這一次它可以工作。

0

您可以選擇從郵件正文中(即使是供內部使用SOAP信封),在您的inSequence中下面的代碼的任何信息:

<property name="JMSDestination" expression="$body/content/entry/textMessage/@JMSDestination"/> 

驗證您的消息正在使用適當的消息生成器進行生成,否則您無法看到消息聖人的內容。看到這個JMS代理示例:

<?xml version="1.0" encoding="UTF-8"?> 
<proxy xmlns="http://ws.apache.org/ns/synapse" name="JMSProxyName" transports="jms" startOnLoad="true" trace="disable"> 
    <target> 
     <inSequence> 
      <log level="custom"> 
       <property name="Log JMSDestination" expression="$body/content/entry/textMessage/@JMSDestination"/> 
      </log> 
      <drop/> 
     </inSequence> 
     <outSequence/> 
     <faultSequence/> 
    </target> 
    <parameter name="transport.jms.ContentType"> 
     <rules> 
      <jmsProperty>contentType</jmsProperty> 
      <default>application/xml</default> 
     </rules> 
    </parameter> 
    <parameter name="transport.jms.Destination">YourQueue</parameter> 
</proxy> 
+0

它不返回任何東西,它只考慮SOAP返回消息,而不是我已經提到的JMS消息 –

+0

在inSequence中放入一個「'作爲第一個介體並檢查您的內容。 – FiveO

+0

它只會給消息的肥皂信封,謝謝你我已經得到如何訪問這些屬性 –