Daniel Stiefel
Daniel Stiefel

Reputation: 211

remove <text>-tag from output while writing file with vfs

i want to write a file with the payload as csv(as plan taxt) in an sequence. My problem is that i always get the <text xmlns="http://ws.apache.org/commons/ns/payload">-tag surrounding my data.

Can anybody help my removing this tag?

Result:

    <text xmlns="http://ws.apache.org/commons/ns/payload">HALLO 13,hallo 11,hallo 12,hallo 11hallo 12
HALLO 23,hallo 21,hallo 22,hallo 21hallo 22
HALLO 33,hallo 31,hallo 32,hallo 31hallo 32</text>

Sequence:

<?xml version="1.0" encoding="UTF-8"?>
<sequence name="fileWriteSequence" trace="disable" xmlns="http://ws.apache.org/ns/synapse">

    <property name="OUT_ONLY" scope="default" type="STRING" value="true"/>
    <property expression="fn:concat( get-property('NewFileName'), '.', get-property('NewFileFormat'))" name="transport.vfs.ReplyFileName" scope="transport" type="STRING" xmlns:ns2="http://org.apache.synapse/xsd"/>
    <property name="messageType" scope="axis2-client" type="STRING" value="text/plain"/> 
    <send>
        <endpoint name="FileEpr">
            <address format="pox" uri="vfs:file:///C:/WSO2/ESB/VFS/OUTPUT/"/>
        </endpoint>
    </send>
</sequence>

Upvotes: 3

Views: 448

Answers (1)

Chandana
Chandana

Reputation: 2658

This was working fine for old releases of WSO2 products and we also faced the same issue with WSO2 EI 6.3.0 and 6.2.0 versions.

It seems WSO2 did a change on message formatter direction logic since format="pox" is defined in the endpoint level. It's Ignoring the messageType property in newer releases. Therefore you have to remove endpoint format configuration from your address endpoint.

So you need to change your logic as below:

<?xml version="1.0" encoding="UTF-8"?>
<sequence name="fileWriteSequence" trace="disable" xmlns="http://ws.apache.org/ns/synapse">

    <property action="set" name="OUT_ONLY" value="true"/>
    <property expression="fn:concat( get-property('NewFileName'), '.', get-property('NewFileFormat'))" name="transport.vfs.ReplyFileName" scope="transport" type="STRING" xmlns:ns2="http://org.apache.synapse/xsd"/>
    <property name="messageType" value="text/plain" scope="axis2"/>
    <property name="ContentType" value="text/plain" scope="axis2"/>
    <send>
        <endpoint name="FileEpr">
            <address uri="vfs:file:///C:/WSO2/ESB/VFS/OUTPUT/"/>
        </endpoint>
    </send>
</sequence>

Upvotes: 1

Related Questions