Can we Set a Send mediator with Xpath expression

非 Y 不嫁゛ 提交于 2019-12-24 15:32:12

问题


i am trying to send a message to my email for that i am using send mediator as well i setup required configurations in AXIS2 file

is it work for below proxy if not what is the way to give xpath to send mediator

<proxy xmlns="http://ws.apache.org/ns/synapse" name="mailCheck" transports="http" statistics="disable" trace="disable" startOnLoad="true">
   <target>
      <inSequence>
         <property name="Subject" value="Alert Message From WSO2 ESB - Service Down !!!" scope="transport" type="STRING"/>
         <property name="messageType" value="text/html" scope="axis2" type="STRING"/>
         <property name="ContentType" value="text/html" scope="axis2" type="STRING"/>
         <property name="Mail" value="mailto:faisal.shaik@youtility.in" scope="default" type="STRING"/>
         <log level="full">
            <property name="Mail" value="mailto:faisal.shaik@youtility.in"/>
         </log>
         <property name="OUT_ONLY" value="true" scope="default" type="STRING"/>
         <send>
            <endpoint key-expression="get-property('Mail')"/>
         </send>
      </inSequence>
      <outSequence/>
   </target>
   <description></description>
</proxy>

if need any changes pls let me know


回答1:


if you want to get the email address from a property value then use the header mediator to set value of "To" to "mailto:faisal.shaik@youtility.in".

You can do that adding the following before the send mediator

<header name="To" expression="fn:concat('mailto:', get-property('Mail'))"/>



回答2:


You can use this:

<property name="To" expression="get-property('uri.var.to')" scope="transport"/>
<send>
    <endpoint>
        <address uri="mailto:"/>
     </endpoint>
</send>



回答3:


   <send>
             <address uri="mailto:xxx@yyy"/>
         </send>

key-expression also can be used..



来源:https://stackoverflow.com/questions/17443696/can-we-set-a-send-mediator-with-xpath-expression

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!