I'm trying to send a form with a file and two inputs to an Mule inbound-endpoint. I've got a custom-processor, and a flow defined like that:
<custom-processor class="informa.app.classifier.transformers.MyfileUploadProcessor" name="fileuploadprocessor"></custom-processor>
<flow name="httpTest">
<http:inbound-endpoint
address="http://tango.privada.informa:11002/services/fileupload"></http:inbound-endpoint>
<processor ref="fileuploadprocessor"/>
</flow>
In the class MyfileUploadProcessor:
public class MyfileUploadProcessor implements MessageProcessor {
@Override
public MuleEvent process(MuleEvent event) throws MuleException {
// TODO Auto-generated method stub
String response = "success";
MuleMessage mulemessage = event.getMessage();
String countryCode = mulemessage.getInboundProperty("username");
String sourceCode = mulemessage.getInboundProperty("password");
InputStream input = (InputStream) mulemessage.getPayload();
...
And to test, a simple html:
<form action="http://tango.privada.informa:11002/services/fileupload" method="post"
enctype="multipart/form-data">
<p>Country Code :<input type="text" name="username" /></p>
<p>Source Code :<input type="text" name="password" /></p>
<p>File :<input type="file" name="payload" /></p>
<p><input type="submit" name="submit" value="submit" />
<input type="reset" name="reset" value="reset"></p>
</form>
</body>
</html>
The issue is I can't create a file from the payload of the mulemessage and I don't know how to get the value of the inputs in the form...what I'm doing wrong? any clues?
Thanks in advance