Tuesday, May 11, 2010

OSB: how to write something to a file

create  a BS,
type Messaging Service,
Request Message Type = text,
Response Message Type = none,
Transport Protocol. File
end point URI: add your destination directory

The payload will be written to a file with a name like this:
8777563012195256358--6573da2d.12881bdd24b.-7fbe

If you want to set the filename (which sounds reasonable) should set the transport headers :
<file:filePath      xmlns:file="http://www.bea.com/wli/sb/transports/file">C:\temp\files\peppolino.txt</file:filePath>


The response document will be empty, and the response metadata will be

 0
 utf-8
 
 C:\geo\filewriterout\1397675502822972061-34dc1924.129e5f8c47d.-7fc6
 
 








Since the input is specified as text, it can be anything, not necessarily XML.

To set the file name, in the Route node use the option "Set Transport Headers for[ Outbound Request ]" and selected Pass all Headers through Pipeline in the calling proxy.



5 comments:

Unknown said...

Hi

How to set this file name like reasonable, I didn't get that step, Could you please explain me.


thanks
suresh

vernetto said...

hi Suresh, I have added a paragraph to explain how to add the transport header. It's an option in the Route command...

Unknown said...

Hi Pierluigi,

Thanks so much for the response. As per your comment I have done that. But I am expecting abc_YYYYMMDD_Sequence.txt ?? Is it possible in OSB ??

appreciate for your help..


Suresh

vernetto said...

Suresh, you can compute dynamically the filename with an XQuery expression, with a Java Callout, or if you are brave enough you could use the Oracle File Adapter (RAR) which implement OOTB this date/sequence functionality

Unknown said...

Hi Pierluigi,

got it. Thanks so much for the reply...


thanks
Suresh