Thanks for the excellent reply!
It looks as though the properties you provided as examples:
<property name="file path" expression="$trp:FILE_PATH"/>
<property name="file name" expression="$trp:FILE_NAME"/>
That the constant values provided in the expression were derived from those
in
org.apache.synapse.transport.vfs.VFSConstants?
If that's the case, it maybe worth pointing that out in the Configuration
Language guide (or if I can be granted permission, I can add that note, or I
can just create Jira).
Regards,
jeff
On Tue, Aug 12, 2008 at 2:59 AM, Asankha C. Perera <[EMAIL PROTECTED]> wrote:
> Hi Jeff
>
>> I'm trying to setup an inSequence node that, when validation fails, an
>> email
>> is sent out. The inbound message is arriving via transport.vfs. I'd like
>> the
>> content of my email to include the name of the inbound file. My on-fail
>> looks like:
>>
>> <on-fail>
>> <property name="Subject" value="Errors occurs when processing order"
>> scope="transport"/>
>> <xslt key="xslt-key-email" source="//*[local-name()='csv']">
>> <property name="filename"
>> expression="get-property('transport.vfs.FileName')" scope="transport"/>
>> </xslt>
>> <send>
>> <endpoint>
>> <address uri="mailto:[EMAIL PROTECTED]" format="pox"/>
>> </endpoint>
>> </send>
>> <drop/>
>> </on-fail>
>>
>> The filename parameter being passed to the xstl fails because the property
>> isn't found. I've even tried instead to get one of the previously defined
>> properties, such as "transport.vfs.FileURI", but that doesn't work either.
>>
>>
> The transport.vfs.FileURI is the URI of the file being polled.. this could
> be a directory as well, or a file etc.
>
>> To be honest, this is a fairly constant frustration for me -- I never seem
>> to be able to printout property values successfully where log level is
>> custom either. It seems as though when you specify log level="full", it
>> would print out ALL the property valus, but that often doesn't appear to
>> be
>> the case (it just seems to print out only message context, not the
>> transport-specific ones).
>>
>>
> Sorry for the delay as I was traveling last week..
>
> But try this config:
>
> <definitions xmlns="http://ws.apache.org/ns/synapse">
> <proxy name="StockQuoteProxy" transports="vfs">
> <parameter name="transport.vfs.FileURI">file:///tmp/in</parameter>
> <!--CHANGE-->
> <parameter name="transport.vfs.ContentType">text/plain</parameter>
> <parameter name="transport.vfs.FileNamePattern">.*\.txt</parameter>
> <parameter name="transport.PollInterval">15</parameter>
> <parameter
> name="transport.vfs.MoveAfterProcess">file:///tmp/original</parameter>
> <!--CHANGE-->
> <parameter
> name="transport.vfs.MoveAfterFailure">file:///tmp/original</parameter>
> <!--CHANGE-->
> <parameter name="transport.vfs.ActionAfterProcess">MOVE</parameter>
> <parameter name="transport.vfs.ActionAfterFailure">MOVE</parameter>
>
> <target>
> <inSequence>
> <log level="full">
> <property name="file path" expression="$trp:FILE_PATH"/>
> <property name="file name" expression="$trp:FILE_NAME"/>
> <property name="file size"
> expression="$trp:FILE_LENGTH"/>
> <property name="last modified"
> expression="$trp:LAST_MODIFIED"/>
> </log>
> </inSequence>
> </target>
> </proxy>
> </definitions>
>
> Note: you could also use the get-property('FILE_PATH') function as usual at
> transport scope instead of the cooler $trp:FILE_PATH etc
>
> and you will see the following log message:
> 2008-08-12 14:25:47,383 [-] [vfs-Worker-1] INFO LogMediator To: ,
> MessageID: urn:uuid:C9CD4AB9611C879A8B1218531347310, Direction: request,
> file path = /tmp/in/hello.txt, file name = hello.txt, file size = 29, last
> modified = 1218531282000, Envelope: <?xml version='1.0'
> encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="
> http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><axis2ns1:text
> xmlns:axis2ns1="http://ws.apache.org/commons/ns/payload">some text here
> som more text</axis2ns1:text></soapenv:Body></soapenv:Envelope>
>
> So basically the problem was not a bug, but the name of the property you
> were looking at.. If you can help us improve our documentation that would be
> most welcome :)
>
> asankha
>
> --
> Asankha C. Perera
>
> WSO2 - http://wso2.org
> http://esbmagic.blogspot.com
>
>