Why WSO2 ESB is Encoding Email Attachment in Base64 - wso2

My proxy service receiving email from Gmail IMAP server. Email has csv file attachment as well. WSO2 ESB received the email successfully but in the logs attachment content is printed as base64 encoded string. Below are my axis2.xml connfigs.
<!-- ================================================= -->
<!-- Message Formatters -->
<!-- ================================================= -->
<!-- Following content type to message formatter mapping can be used to implement support -->
<!-- for different message format serializations in Axis2. These message formats are -->
<!-- expected to be resolved based on the content type. -->
<messageFormatters>
<messageFormatter contentType="application/x-www-form-urlencoded"
class="org.apache.synapse.commons.formatters.XFormURLEncodedFormatter"/>
<messageFormatter contentType="multipart/form-data"
class="org.apache.axis2.transport.http.MultipartFormDataFormatter"/>
<messageFormatter contentType="application/xml"
class="org.apache.axis2.transport.http.ApplicationXMLFormatter"/>
<messageFormatter contentType="text/xml"
class="org.apache.axis2.transport.http.SOAPMessageFormatter"/>
<messageFormatter contentType="application/soap+xml"
class="org.apache.axis2.transport.http.SOAPMessageFormatter"/>
<messageFormatter contentType="text/plain"
class="org.apache.axis2.format.PlainTextFormatter"/>
<messageformatter contenttype="text/csv" class="org.apache.axis2.format.PlainTextFormatter"/>
<!--JSON Message Formatters-->
<messageFormatter contentType="application/json"
class="org.apache.synapse.commons.json.JsonStreamFormatter"/>
<!--messageFormatter contentType="application/x-www-form-urlencoded"
class="org.wso2.carbon.relay.ExpandingMessageFormatter"/-->
<!--messageFormatter contentType="multipart/form-data"
class="org.wso2.carbon.relay.ExpandingMessageFormatter"/-->
<messageFormatter contentType="application/xml"
class="org.wso2.carbon.relay.ExpandingMessageFormatter"/>
<!--messageFormatter contentType="text/html"
class="org.wso2.carbon.relay.ExpandingMessageFormatter"/-->
<!--messageFormatter contentType="application/soap+xml"
class="org.wso2.carbon.relay.ExpandingMessageFormatter"/-->
<messageFormatter contentType="text/xml"
class="org.wso2.carbon.relay.ExpandingMessageFormatter"/>
<!--messageFormatter contentType="x-application/hessian"
class="org.apache.synapse.format.hessian.HessianMessageFormatter"/-->
<!--messageFormatter contentType=""
class="org.apache.synapse.format.hessian.HessianMessageFormatter"/-->
<!--messageFormatter contentType="application/edi-hl7"
class="org.wso2.carbon.business.messaging.hl7.message.HL7MessageFormatter"/-->
</messageFormatters>
<!-- ================================================= -->
<!-- Message Builders -->
<!-- ================================================= -->
<!-- Following content type to builder mapping can be used to implement support for -->
<!-- different message formats in Axis2. These message formats are expected to be -->
<!-- resolved based on the content type. -->
<messageBuilders>
<messageBuilder contentType="application/xml"
class="org.apache.axis2.builder.ApplicationXMLBuilder"/>
<messageBuilder contentType="application/x-www-form-urlencoded"
class="org.apache.synapse.commons.builders.XFormURLEncodedBuilder"/>
<messageBuilder contentType="multipart/form-data"
class="org.apache.axis2.builder.MultipartFormDataBuilder"/>
<messageBuilder contentType="text/plain"
class="org.apache.axis2.format.PlainTextBuilder"/>
<!--JSON Message Builders-->
<messagebuilder contenttype="text/csv" class="org.apache.axis2.format.PlainTextBuilder"/>
<messageBuilder contentType="application/json"
class="org.apache.synapse.commons.json.JsonStreamBuilder"/>
<messageBuilder contentType="application/xml"
class="org.wso2.carbon.relay.BinaryRelayBuilder"/>
<!--messageBuilder contentType="application/x-www-form-urlencoded"
class="org.wso2.carbon.relay.BinaryRelayBuilder"/-->
<!--messageBuilder contentType="multipart/form-data"
class="org.wso2.carbon.relay.BinaryRelayBuilder"/-->
<messageBuilder contentType="multipart/related"
class="org.wso2.carbon.relay.BinaryRelayBuilder"/>
<!--<messageBuilder contentType="multipart/related" class="org.apache.axis2.builder.MIMEBuilder"/>-->
<!--messageBuilder contentType="application/soap+xml"
class="org.wso2.carbon.relay.BinaryRelayBuilder"/-->
<messageBuilder contentType="text/plain"
class="org.wso2.carbon.relay.BinaryRelayBuilder"/>
<messageBuilder contentType="text/xml"
class="org.wso2.carbon.relay.BinaryRelayBuilder"/>
<!--messageBuilder contentType="x-application/hessian"
class="org.apache.synapse.format.hessian.HessianMessageBuilder"/-->
<!--messageBuilder contentType=""
class="org.apache.synapse.format.hessian.HessianMessageBuilder"/-->
<!--messageBuilder contentType="application/edi-hl7"
class="org.wso2.carbon.business.messaging.hl7.message.HL7MessageBuilder"/-->
</messageBuilders>
Log:
INFO - LogMediator To: /services/MailService MessageID: urn:uuid:492da964-ee6c-4ae7-b444-269ba8a52641 Direction: request%%%%%%%%%%%%Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><ns:binary xmlns:ns="http://ws.apache.org/commons/ns/payload">LS05NGViMmMxNDMyYmFmNmU3N2EwNTRiNGJiMzc5DQpDb250ZW50LVR5cGU6IG11bHRpcGFydC9hbHRlcm5hdGl2ZTsgYm91bmRhcnk9OTRlYjJjMTQzMmJhZjZlNzc2MDU0YjRiYjM3Nw0KDQotLTk0ZWIyYzE0MzJiYWY2ZTc3NjA1NGI0YmIzNzcNCkNvbnRlbnQtVHlwZTogdGV4dC9wbGFpbjsgY2hhcnNldD1VVEYtOA0KDQoNCg0KLS05NGViMmMxNDMyYmFmNmU3NzYwNTRiNGJiMzc3DQpDb250ZW50LVR5cGU6IHRleHQvaHRtbDsgY2hhcnNldD1VVEYtOA0KDQo8ZGl2IGRpcj0ibHRyIj48L2Rpdj4NCg0KLS05NGViMmMxNDMyYmFmNmU3NzYwNTRiNGJiMzc3LS0NCi0tOTRlYjJjMTQzMmJhZjZlNzdhMDU0YjRiYjM3OQ0KQ29udGVudC1UeXBlOiB0ZXh0L2NzdjsgY2hhcnNldD1VUy1BU0NJSTsgbmFtZT0iY3N2LmNzdiINCkNvbnRlbnQtRGlzcG9zaXRpb246IGF0dGFjaG1lbnQ7IGZpbGVuYW1lPSJjc3YuY3N2Ig0KQ29udGVudC1UcmFuc2Zlci1FbmNvZGluZzogYmFzZTY0DQpYLUF0dGFjaG1lbnQtSWQ6IGZfajBra3Q0OWYwDQoNCmQyRnhZWE1zWVdkbERRcDNZWEZoY3l3eU13PT0NCi0tOTRlYjJjMTQzMmJhZjZlNzdhMDU0YjRiYjM3OS0tDQo=</ns:binary></soapenv:Body></soapenv:Envelope></soapenv:Body></soapenv:Envelope>
[2017-03-22 11:16:46,049] DEBUG - RelayUtils Content Type is multipart/mixed; boundary=94eb2c1432baf6e77a054b4bb379
Proxy Code:
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="MailTransportProtocolIMAP"
startOnLoad="true"
statistics="disable"
trace="disable"
transports="mailto">
<target>
<inSequence>
<log level="full" separator="---=== Invalid Subject ===---"/>
</inSequence>
<outSequence/>
</target>
<parameter name="mail.imap.starttls.enable">false</parameter>
<parameter name="mail.imap.socketFactory.port">993</parameter>
<parameter name="transport.mail.Address">mapperxslt1#gmail.com</parameter>
<parameter name="mail.imap.fetchsize">100000</parameter>
<parameter name="mail.imap.user">mapperxslt1</parameter>
<parameter name="mail.imap.password">Password</parameter>
<parameter name="transport.mail.ActionAfterProcess">MOVE</parameter>
<parameter name="mail.imap.host">imap.gmail.com</parameter>
<parameter name="transport.mail.ContentType">multipart/mixed</parameter>
<parameter name="transport.mail.MoveAfterProcess">Processed</parameter>
<parameter name="mail.imap.port">993</parameter>
<parameter name="transport.PollInterval">5</parameter>
<parameter name="transport.mail.Protocol">imap</parameter>
<parameter name="transport.mail.Folder">inbox</parameter>
<parameter name="mail.imap.socketFactory.class">javax.net.ssl.SSLSocketFactory</parameter>
<parameter name="mail.imap.ssl.enable">false</parameter>
<parameter name="mail.imap.socketFactory.fallback">false</parameter>
<description/>
</proxy>
Is there any way in WSO2 ESB to save the attachment as it is in the directory? Any help would be great favor.

You can access the content inside request/response payload of csv by registering "org.apache.axis2.format.PlainTextBuilder" and "org.apache.axis2.format.PlainTextFormatter" as message builder and formatter for text/csv content-type.
Please add the following formatters and builders to axis2.xml. please check builder.
<messageformatter contenttype="text/csv" class="org.apache.axis2.format.PlainTextFormatter"/>
<messagebuilder contenttype="text/csv" class="org.apache.axis2.format.PlainTextBuilder"/>

Related

WSO2 - EI 6.2.0 - Configuring Oracle AQ JMS database with EI to publish/consume messages to/from Oracle AQ JMS

This is Radhakrishnan and new to WSO2 world. Would like to configure the Oracle AQ JMS with EI so that EI can consume/publish messages from Oracle AQ JMS.
Configuration for axis2.xml has been done and written a Proxy to consume message from Oracle AQ JMS.
Now when we are publishing to Oracle AQ JMS we are getting below error and anybody has suggestion/valuable inputs?
Caused by: javax.naming.NameNotFoundException: Name [dynamicQueues//RIB_AQ_USER.ETEXTPAYTERM] is not bound in this Context. Unable to find [dynamicQueues].
at org.apache.naming.NamingContext.lookup(NamingContext.java:825)
at org.apache.naming.NamingContext.lookup(NamingContext.java:173)
at org.wso2.carbon.context.internal.CarbonContextDataHolder$CarbonInitialJNDIContext.lookup(CarbonContextDataHolder.java:709)
Here is the code snippet:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="RMSPayTermOutToRMSProxy"
startOnLoad="true"
statistics="disable"
trace="disable"
transports="http,https">
<target>
<inSequence>
<log level="full"/>
<property name="OUT_ONLY" scope="default" type="STRING" value="true"/>
<property name="FORCE_SC_ACCEPTED" scope="axis2" value="true"/>
<send>
<endpoint>
<address format="pox"
uri="jms2:/RIB_AQ_USER.ETEXTPAYTERM?transport.jms.ConnectionFactoryJNDIName=JMSSenderTopicConnectionFactory"/>
</endpoint>
</send>
</inSequence>
</target>
<parameter name="serviceType">proxy</parameter>
<description/>
</proxy>
I have faced a similar problem a year ago, and we fixed using the below configurations.
We have configured the Connection Factory(AqQueueConnectionFactory) in axis2.xml
<!-- Oracle AQ Listener Start-->
<transportReceiver name="oracleaq" class="org.apache.axis2.transport.jms.JMSListener">
<parameter name="AqQueueConnectionFactory" locked="false">
<parameter name="java.naming.factory.initial" locked="false">oracle.jms.AQjmsInitialContextFactory</parameter>
<parameter name="db_url" locked="false">jdbc:oracle:thin:#hostname:port:schema</parameter>
<parameter name="java.naming.security.principal" locked="false">username</parameter>
<parameter name="java.naming.security.credentials" locked="false">password</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">QueueConnectionFactory</parameter>
<parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>
</parameter>
<parameter name="AqTopicConnectionFactory" locked="false">
<parameter name="java.naming.factory.initial" locked="false">oracle.jms.AQjmsInitialContextFactory</parameter>
<parameter name="db_url" locked="false">jdbc:oracle:thin:#hostname:port:schema</parameter>
<parameter name="java.naming.security.principal" locked="false">username</parameter>
<parameter name="java.naming.security.credentials" locked="false">password</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">TopicConnectionFactory</parameter>
<parameter name="transport.jms.ConnectionFactoryType" locked="false">topic</parameter>
</parameter>
</transportReceiver>
<!-- Oracle AQ Listener End -->
We have to restart the server after changing the axis2.xml and adding the following jar file (aqapi-10.1.3.1.jar and its dependencies) in the lib folder.
In the Proxy, Parameters section, we defined the Queue configuration to which the Proxy listens to.
<parameter name="transport.jms.DestinationType">queue</parameter>
<parameter name="transport.jms.Destination">Queues/QueueName</parameter>
<parameter name="transport.jms.ContentType">
<rules xmlns="">
<jmsProperty>contentType</jmsProperty>
<default>application/xml</default>
</rules>
</parameter>
<parameter name="transport.jms.ConnectionFactory">AqQueueConnectionFactory</parameter>
AS stated above in the axis2.xml, we enabled the oracleaq as one if the transport of the proxy.
Once the above setup is done, we can listen to the queues/topics from Oracle AQ without any issues.
Thanks.

wso2 EI 611 ActiveMQ

Declared Message store in ESB
<?xml version="1.0" encoding="UTF-8"?>
<messageStore class="org.apache.synapse.message.store.impl.jms.JmsStore" name="MySQLStockAdjustment" xmlns="http://ws.apache.org/ns/synapse">
<parameter name="store.jms.destination">MySQLStockAdjustment</parameter>
<parameter name="store.failover.message.store.name">MySQLStockAdjustmentFailover</parameter>
<parameter name="store.jms.connection.factory">myQueueConnectionFactory</parameter>
<parameter name="store.producer.guaranteed.delivery.enable">true</parameter>
<parameter name="store.jms.cache.connection">false</parameter>
<parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
<parameter name="java.naming.provider.url">tcp://localhost:61616</parameter>
<parameter name="store.jms.JMSSpecVersion">1.1</parameter>
</messageStore>
and I just want for beginning to store the mesage in it and than use a proxy to read messages form it ..
proxy is simple
<?xml version="1.0" encoding="UTF-8"?>
<proxy name="stockAdjustment" startOnLoad="true" transports="jms" xmlns="http://ws.apache.org/ns/synapse">
<target>
<inSequence>
<!-- get all data -->
<sequence key="AdjustmentContext"/>
<filter regex="MySQL" source="$ctx:StockSource">
<then>
<iterate expression="//request">
<target>
<sequence>
<property expression="//qty" name="qty" scope="default" type="STRING"/>
<property expression="//code" name="code" scope="default" type="STRING"/>
<log level="custom">
<property expression="fn:concat('parmams:Code: ' ,$ctx:code, ' ;Qty: ',$ctx:qty)" name="info"/>
</log>
<call blocking="true">
<endpoint key="StockAdjustmentEp"/>
</call>
</sequence>
</target>
</iterate>
</then>
<else/>
</filter>
</inSequence>
<outSequence>
<send/>
</outSequence>
<faultSequence>
</faultSequence>
</target>
<parameter name="transport.jms.Destination">MySQLStockAdjustment</parameter>
<parameter name="transport.jms.ConnectionFactory">myQueueConnectionFactory</parameter>
</proxy>
so when I send a data message trough Postman Im getting the following:
WARN {org.apache.axis2.transport.jms.JMSUtils} - Can't determine size of JMS message; unsupported message type : org.apache.activemq.command.ActiveMQObjectMessage {org.apache.axis2.transport.jms.JMSUtils}
ERROR {org.apache.axis2.transport.base.BaseUtils} - Unsupported JMS message type org.apache.activemq.command.ActiveMQObjectMessage {org.apache.axis2.transport.base.BaseUtils}
ERROR {org.apache.axis2.transport.jms.JMSMessageReceiver} - Unknown error processing message {org.apache.axis2.transport.jms.JMSMessageReceiver}
message is
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Body>
<StockAdjRequest>
<source>MySQL</source>
<request><qty>2</qty><code>PR2</code></request>
<request><qty>2</qty><code>PR2</code></request>
<request><qty>2</qty><code>PR2</code></request>
</StockAdjRequest>
</soapenv:Body>
</soapenv:Envelope>
I see that message ended in queue but I can't read it trough ActiveMQ web console ...
I documentation I found that maybe a proble that I need to "...If you are using ActiveMQ 5.12.2 and above when working with message stores, you need to set the following system property on server start up for the JMS message store of the ESB Profile to work as expected.
-Dorg.apache.activemq.SERIALIZABLE_PACKAGES="*" ...."
BUt I dont found HOW to do it ... can anyone help me ?
When you store a message in a JMS queue defining a messageStore and using store mediator, you don't just store the "textual" payload from the message, but the entire java MessageContext object is serialized and store as a binary message in the queue.
To read such a message, you need to use a message processor, you can't read it with a simple JMS proxy or even jms inbound endpoint.
And you can't read it with ActiveMQ console because it can't deserialize it

WSO2 Integrator 6, File inbound Protocol process code

Currently working for a company on wso2 integrator, I need to retrieve files periodically created into a directory so that they can be processed, modified and sent to a remote API.
The problem is that we need to use wso2 exclusively and absolutely can't code side programs to adapt to the situation. We can use script though only if they are embedded within wso2.
Does someone have a clue?
This is a simple synapse configuration that:
Wait for incoming CSV files on a given directory
Convert its contents to XML
Do some transformation on its elements
Sends the result to a another endpoint (an output directory in this case)
I hope it helps to get you going (comments inline):
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://ws.apache.org/ns/synapse">
<!-- ======================================== -->
<!-- Smooks configuration to parse sample CSV -->
<!-- ======================================== -->
<localEntry key="smooks-orders-csv">
<smooks-resource-list
xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd" xmlns:csv="http://www.milyn.org/xsd/smooks/csv-1.2.xsd">
<resource-config selector="org.xml.sax.driver">
<resource>org.milyn.csv.CSVReader</resource>
<param name="fields">OrderId,SKU,Quantity,UnitPrice,TotalPrice</param>
<param name="skip-line-count">1</param> <!-- Skip Header line -->
<param name="rootElementName">orders</param>
<param name="recordElementName">order</param>
</resource-config>
</smooks-resource-list>
</localEntry>
<!-- ====================================================== -->
<!-- XML processing logic: Replaces SKU number 0002 to 0003 -->
<!-- ====================================================== -->
<localEntry key="change-sku">
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="#*|node()">
<xsl:copy>
<xsl:apply-templates select="#*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="SKU/text()[.='0002']">0003</xsl:template>
</xsl:stylesheet>
<description/>
</localEntry>
<!-- *********************** -->
<!-- Process Orders sequence -->
<!-- *********************** -->
<sequence name="process_orders" onError="fault" statistics="enable" trace="enable">
<!-- Convert incoming file into a stream of orders -->
<smooks config-key="smooks-orders-csv">
<input type="text"/>
<output type="xml"/>
</smooks>
<!-- General Synapse properties that must be set for a One-Way exchange pattern -->
<property name="FORCE_SC_ACCEPTED" scope="axis2" value="true"/>
<property name="OUT_ONLY" value="true"/>
<!-- VFS send will fail unless you remove this property -->
<property action="remove" name="ClientApiNonBlocking" scope="axis2"/>
<!-- The "magic" property 'transport.vfs.ReplyFileName' is used by the VFS transport to define output file name
when the specified URI is a directory
-->
<property
expression="fn:concat(fn:substring-after(get-property('MessageID'), 'urn:uuid:'), '.xml')"
name="transport.vfs.ReplyFileName" scope="transport" xmlns:ns="http://org.apache.synapse/xsd"/>
<!-- Create output file -->
<send>
<endpoint>
<address format="pox" uri="vfs:file:///mnt/c/transfer/out"/>
</endpoint>
</send>
</sequence>
<!-- Inbound polling endpoint -->
<inboundEndpoint name="received_orders" onError="fault"
protocol="file" sequence="process_orders" suspend="false">
<parameters>
<parameter name="interval">1000</parameter>
<parameter name="sequential">true</parameter>
<parameter name="coordination">true</parameter>
<!-- Input directory -->
<parameter name="transport.vfs.FileURI">file:///mnt/c/transfer/in</parameter>
<!-- CSV files are plain text messages -->
<parameter name="transport.vfs.ContentType">text/plain</parameter>
<!-- RegExp used to filter files in input directory -->
<parameter name="transport.vfs.FileNamePattern">.*\.txt</parameter>
<parameter name="transport.vfs.Locking">disable</parameter>
<!-- Move processed files to the 'processed' subdirectory -->
<parameter name="transport.vfs.ActionAfterProcess">MOVE</parameter>
<parameter name="transport.vfs.MoveAfterProcess">file:///mnt/c/transfer/in/processed</parameter>
<!-- Move failed files to the 'rejected subdirectory -->
<parameter name="transport.vfs.ActionAfterFailure">MOVE</parameter>
<parameter name="transport.vfs.MoveAfterFailure">file:///mnt/c/transfer/in/rejected</parameter>
<parameter name="transport.vfs.AutoLockRelease">true</parameter>
<parameter name="transport.vfs.LockReleaseSameNode">false</parameter>
<parameter name="transport.vfs.DistributedLock">false</parameter>
<parameter name="transport.vfs.FileSortAttribute">NONE</parameter>
<parameter name="transport.vfs.FileSortAscending">true</parameter>
<parameter name="transport.vfs.CreateFolder">true</parameter>
<parameter name="transport.vfs.Streaming">false</parameter>
<parameter name="transport.vfs.Build">false</parameter>
</parameters>
</inboundEndpoint>
</definitions>

Wso2 mailto transport emptied my Inbox

I was working with the wso2 esb mail transport. I configured my mail id and all the details in the axis2.xml. When I restarted the Wso2 esb, I found that my Inbox is emptied.
Here is my axix2.xml:
<!-- ================================================= -->
<!-- Transport Ins (Listeners) -->
<!-- ================================================= -->
<transportReceiver name="mailto" class="org.apache.axis2.transport.mail.MailTransportListener">
<!-- configure any optional POP3/IMAP properties
check com.sun.mail.pop3 and com.sun.mail.imap package documentation for more details-->
</transportReceiver>
<!-- ================================================= -->
<!-- Transport Outs (Senders) -->
<!-- ================================================= -->
<!-- Uncomment and configure the SMTP server information
check com.sun.mail.smtp package documentation for descriptions of properties-->
<transportSender name="mailto" class="org.apache.axis2.transport.mail.MailTransportSender">
<parameter name="mail.smtp.host">mum.*******.com</parameter>
<parameter name="mail.smtp.port">587</parameter>
<parameter name="mail.smtp.starttls.enable">true</parameter>
<parameter name="mail.smtp.auth">true</parameter>
<parameter name="mail.smtp.user">*******</parameter>
<parameter name="mail.smtp.password">*********</parameter>
<parameter name="mail.smtp.from">*******#*****.com</parameter>
</transportSender>
Here is my proxy:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="MailSample"
startOnLoad="true"
trace="disable">
<description/>
<target>
<inSequence>
<log>
<property name="hii" value="hi************************"/>
</log>
<property name="senderAddress" expression="get-property('transport', 'From')"/>
<log level="full">
<property name="Sender Address" expression="get-property('senderAddress')"/>
</log>
<send>
<endpoint>
<address uri="mailto:janiyani.richa#gmail.com"/>
</endpoint>
</send>
</inSequence>
</target>
<parameter name="transport.jms.ContentType">
<rules>
<jmsProperty>contentType</jmsProperty>
<default>application/xml</default>
</rules>
</parameter>
<parameter name="transport.jms.Destination">mailSender</parameter>
</proxy>
Do you know where did my mails go?
Is it possible to retrieve the mails?
Thanks in Advance.
By default, most POP3 mail servers keep messages only until they are downloaded by the mail client and then those are deleted. So the above behaviour can be due to that reason and you can prevent this from happening by doing the necessary configurations to leave the messages on server without deleting them even after they are read.
For setting this property at the client (axis2) side, see the mail.pop3.rsetbeforequit property in the com.sun.mail.pop3 documentation available here. (Also depending on the server, there can be server side configurations instead that will make sure that mails will always be kept at the server after being read.)

XPath from file in VFS Transport WSO2 ESB

I want to read some values from a file that being processed by the VFS transport.
My file is :
<sales>
<header>
<source>STORE1</source>
<target>HEADOFFICE</target>
</header>
So I use a property mediator to get the value I want using XPath. But when I print that property in Log Mediator it prints nothing. My proxy look like this :
<proxy name="Try1"
transports="vfs"
startOnLoad="true"
trace="disable">
<target>
<inSequence>
<property xmlns:ns="http://org.apache.synapse/xsd"
name="source"
expression="//header/source/text()"
scope="default"
type="STRING"/>
<log level="full">
<property xmlns:ns="http://org.apache.synapse/xsd"
name="Value_source"
expression="get-property('source')"/>
</log>
</inSequence>
</target>
<parameter name="transport.vfs.ActionAfterProcess">MOVE</parameter>
<parameter name="transport.PollInterval">15</parameter>
<parameter name="transport.vfs.MoveAfterProcess">file:///Users/Target</parameter>
<parameter name="transport.vfs.FileURI">file:///Users/Source</parameter>
<parameter name="transport.vfs.MoveAfterFailure">file:///Users/Failure</parameter>
<parameter name="transport.vfs.FileNamePattern">.*.txt</parameter>
<parameter name="transport.vfs.ContentType">text/plain</parameter>
<parameter name="transport.vfs.ActionAfterFailure">MOVE</parameter>
The log mediator result is
[2013-06-28 16:59:49,939] INFO - LogMediator Value_source=
So how can I get the values in file using XPath?
The issue is due to the ContentType set for the transport parameter:
Switch
<parameter name="transport.vfs.ContentType">text/plain</parameter>
with
<parameter name="transport.vfs.ContentType">application/xml</parameter>
since you're doing XPath operations on the message.
The problem is with the content of your file. Since it is not well-formed, the xpath expression fails. Isn't it possible for you to have the well-formed xml in the input content?
<sales>
<header>
<source>STORE1</source>
<target>HEADOFFICE</target>
</header>
</sales>