WSO2 ESB - 写入文件的base64出来的 [英] WSO2 ESB - writing files out of base64
问题描述
我有一个接受的XML文件使用Base64连接它codeD文件的代理。例如,XML如下:
I have a proxy which accepts XML files with Base64 encoded files in it. For example the XML looks like:
<message>
<content>Hello World</content>
<attachements>
<attachement>*Base64 code here*</attachement>
<attachement>*Base64 code here*</attachement>
<attachement>*Base64 code here*</attachement>
</attachements>
</message>
我的问题:
我喜欢从消息中去codeD文件保存到运行ESB服务器的文件系统中的文件夹。但我怎么能做到这一点?如果我带code一个简单的文本,如Hello World的使用Base64我可以去code将其与脚本中介和Javascript,但我怎么能写一个文件到文件系统?我必须写我自己的中介还是有另一种解决方案,我不知道吗?
My Problem: I like to save the decoded files from the message into a folder of the filesystem of the server running the ESB. But how can I do this? If I encode a simple text like "Hello World" with Base64 I can decode it with an Script Mediator and Javascript, but how can I write a file to the filesystem? Do I have to write my own Mediator or is there another solution I don't know?
将是很好,如果你能帮助我:)
我使用的是WSO2 ESB为我的学士论文。所以我不是一个专业尚未:)
Would be nice if you could help me :) I'm using the WSO2 ESB for my bachelor thesis. So I'm not a professional yet :)
感谢您
推荐答案
您有几种选择,
-
如果文件大小小,遍历
&LT;附件&GT;
并为每个附件,使用脚本中介和去code写入一个文件语法一样,
If file sizes are small, iterate through
<attachments>
and for each attachment, decode using the script mediator and write to a file with syntax like,
<property name="transport.vfs.ReplyFileName"
expression="expression-to-compute-file-name"
scope="transport"/>
<property action="set" name="OUT_ONLY" value="true"/>
<send>
<endpoint>
<address uri="vfs:file:///home/user/test/out"/>
</endpoint>
</send>
如果文件比较大那么它的更有效的来写自己的类中介
If the files are large then it's more efficient to write your own class mediator
这篇关于WSO2 ESB - 写入文件的base64出来的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!