I'm starting with JBoss SwitchYard and I want to replace a old system we have here. The system integrates with others receiving a HTTP Post Multipart form. The content is a Json and a zip file. My service must split this post and save into the file system. I used to do this with Apache Camel, using the servlet component, routing to the file component.
I did try with SwitchYard, and created something like this:
<?xml version="1.0" encoding="UTF-8"?> <switchyard xmlns="urn:switchyard-config:switchyard:1.0" xmlns:bean="urn:switchyard-component-bean:config:1.0" xmlns:camel="urn:switchyard-component-camel-core:config:1.0" xmlns:http="urn:switchyard-component-http:config:1.0" xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912" name="rat-receiver" targetNamespace="urn:com.sigrist:rat-receiver:1.0"> <sca:composite name="rat-receiver" targetNamespace="urn:com.sigrist:rat-receiver:1.0"> <sca:component name="DataReceiverBean"> <bean:implementation.bean class="com.sigrist.receiver.DataReceiverBean"/> <sca:service name="DataReceiver"> <sca:interface.java interface="com.sigrist.receiver.DataReceiver"/> </sca:service> </sca:component> <sca:service name="DataReceiver" promote="DataReceiverBean/DataReceiver"> <sca:interface.java interface="com.sigrist.receiver.DataReceiver"/> <camel:binding.uri name="camel1" configURI="servlet:///data?servletName=CamelHttpMultipartServlet"> <operationSelector operationName="foo2"/> <camel:messageComposer class="com.sigrist.receiver.MyCustomMessageComposer"/> </camel:binding.uri> </sca:service> </sca:composite> </switchyard>
But when I started JBoss, I receive the error messsage:
Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: servlet:///data?servletName=CamelHttpMultipartServlet due to: No component found with scheme: servlet
My pom.xml has the camel-servlet component, but looks like it is not register into camel context used by SwitchYard.
Another try was to use the HTTP Binding. I received the multipart data, but the format is a StringReader, and I need to parse manually the data. I wanted to use something ready, like the ServletFileUpload from the apache commons file upload.
How can I handle this kind of data with SwitchYard?
Thanks in advanced