Hi,

I want to set up a proxy service which receives a csv file (content
type: text/plain) via HTTP, transforms it to XML and writes it to disk.
For this purpose I would like to use the Smooks mediator and I've used
an example on the Smooks website.

My proxy service:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"; name="transformCSVToXML"
transports="http" startOnLoad="true" trace="disable">
    <target faultSequence="fault">
        <inSequence>
            <log level="full"/>
            <property name="FORCE_SC_ACCEPTED" value="true"
scope="axis2"/>
            <smooks
config-key="conf:/repository/NBB/Smooks/smooksConfig1.xml">
                <input
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"; type="text"
expression="//text"/>
                <output type="xml"/>
            </smooks>
            <property name="OUT_ONLY" value="true" scope="default"/>
            <send>
                <endpoint
key="conf:/repository/synapse/default/endpoints/fileshareEndpointNDV"/>
            </send>
        </inSequence>
    </target>
</proxy>

My smooks config looks like:
<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd";
xmlns:csv="http://www.milyn.org/xsd/smooks/csv-1.1.xsd";>
   <csv:reader fields="firstname,lastname,gender,age,country"/>
</smooks-resource-list>

And this is the message I'm sending:
POST http://PC016313:8280/services/transformCSVToXML HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/plain
User-Agent: Jakarta Commons-HttpClient/3.1
Content-Length: 56
Host: PC016313:8280

Tom,Fennelly,Male,4,Ireland
Mike,Fennelly,Male,2,Ireland


My proxy services receives the following:
Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";><soapenv:Body>
<text
xmlns="http://ws.apache.org/commons/ns/payload";>Tom,Fennelly,Male,4,Irel
and
Mike,Fennelly,Male,2,Ireland</text></soapenv:Body></soapenv:Envelope>

And fails with:
ERROR - NativeWorkerPool Uncaught exception
org.milyn.SmooksException: Unable to filter InputStream for target
profile [org.milyn.profile.Profile#default_profile].
        at
org.milyn.delivery.dom.SmooksDOMFilter.filter(SmooksDOMFilter.java:294)
        at
org.milyn.delivery.dom.SmooksDOMFilter.doFilter(SmooksDOMFilter.java:243
)
        at
org.milyn.delivery.dom.SmooksDOMFilter.doFilter(SmooksDOMFilter.java:216
)
        at org.milyn.Smooks._filter(Smooks.java:516)
        at org.milyn.Smooks.filterSource(Smooks.java:475)
        at
org.wso2.carbon.mediator.transform.SmooksMediator.mediate(SmooksMediator
.java:88)
        at
org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMe
diator.java:60)
        at
org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMedia
tor.java:114)
        at
org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyS
erviceMessageReceiver.java:154)
        at
org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:181)
        at
org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostReques
t(HTTPTransportUtils.java:172)
        at
org.apache.synapse.transport.nhttp.ServerWorker.processEntityEnclosingMe
thod(ServerWorker.java:408)
        at
org.apache.synapse.transport.nhttp.ServerWorker.run(ServerWorker.java:25
9)
        at
org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWor
kerPool.java:173)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecuto
r.java:886)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.ja
va:908)
        at java.lang.Thread.run(Thread.java:662)

Anyone an idea how this can be fixed ?

-----------------------------------------
Visit our website! http://www.nbb.be

"DISCLAIMER: The content of this e-mail message should not be
construed as binding on the part of the National Bank of Belgium
(NBB) unless otherwise and previously stated. The opinions
expressed in this message are solely those of the author and do not
necessarily reflect NBB viewpoints, particularly when the content
of this message, or part thereof, is private by nature or does not
fall within the professional scope of its author."

Reply via email to