Hello Christian,
Thank you for your help.  Unfortunately that didn't change the outcome.  The 
AttachmentDeserializer class's "readTillFirstBoundary" still exits upon the 
first read due to a -1 from the first read of the IO stream.  I have tried 
FireFox, Chrome, and IE.  Any other ideas?  Could it be my HTML form?

<html>
        <body>
                <form enctype='multipart/form-data' method='post' 
action='/submit'>
                        <INPUT type='text' id='firstname'>
                        <BR>
                        <input type='file' name='image'>
                        <br>
                        <input type='submit' value='Send'>
                </form>
        </body>
</html>

If not, could I be doing something wrong with my CXF function receiving the 
message?

I've tried both of the following:
    @POST
    @Path("submit")
    @Produces("text/html")
    public String postImage4(Message message) {
        return "hello " + message;
    }
        
    @POST
    @Path("submit")
    @Produces("text/html")
    public String postImage4(List<Attachment> atts) {
        return "hello " + atts;
    }

I've also confirmed I can get to the request by returning the html form from a 
        
    @GET
    @Path("submit")
    @Produces("text/html")
    public String postImage4() {
        return "<html><body><form enctype='multipart/form-data' method='post' 
action='/submit'><INPUT type='text' id='firstname'><BR><input type='file' 
name='image'> <br><input type='submit' value='Send'></form></body></html>";
    }

I don't think it is pathing since the error is occurring in an interceptor but 
I'll entertain any ideas at this point.



Thanks,
Zach Calvert






-----Original Message-----
From: Christian Müller [mailto:christian.muel...@gmail.com] 
Sent: Wednesday, April 17, 2013 4:58 PM
To: users@camel.apache.org
Subject: Re: CXF Bean, MultiPart -> Couldn't find MIME boundary

Can you enable stream caching and try it again.

http://camel.apache.org/stream-caching.html

Best,
Christian

Sent from a mobile device
Am 17.04.2013 23:53 schrieb "Calvert, Zach (Zach)** CTR **" <
zcalv...@motive.com>:

> I'm having trouble submitting a multi-part form to a CXF endpoint.  My 
> route looks like:
>         <camel:route id="submitform">
>             <camel:from uri="jetty:
> https://0.0.0.0:9005/submit/?matchOnUriPrefix=true"/>
>             <camel:log message="Request received" loggingLevel="DEBUG"/>
>             <camel:to uri="cxfbean:consumerList"/>
>         </camel:route>
> Where the list is a util list of 1 endpoint consuming a POST method.  
> The HTML form code is retrieved from the same path using a GET, resulting in:
>
> <html>
>     <body>
>         <form enctype='multipart/form-data' method='post' action='/submit'>
>             <INPUT type='text' id='firstname'>
>             <BR>
>             <input type='file' name='image'>
>             <BR>
>             <input type='submit' value='Send'>
>         </form>
>     </body>
> </html>
>
> Submitting a post triggers this in the logs:
> 2013-04-17 15:55:40,900 | WARN  | qtp11314826-356  |
> WebApplicationExceptionMapper    |  -  -  | WebApplicationException has
> been caught : Couldn't find MIME boundary:
> -----------------------------173102388111750
>
> I walked the code to org.apache.cxf.attachment.AttachmentDeserializer
> Where it obtains the "InputStream" content body using:
> ...
>             boundary = boundaryString.getBytes("utf-8");
>
>             stream = new
> PushbackInputStream(message.getContent(InputStream.class),
>                                              pbAmount); ...
>
> The resulting InputStream from the CXF Message, while non-null, always 
> returns -1 at the first read.  In other words, this InputStream is 
> empty 100% of the time.  I've verified using different browsers that 
> the content is submitted, and the MIME boundary is populated in the 
> content.  What is going on with the input stream?  Have I configured 
> my CXF endpoint incorrectly in some way, or am I missing a configuration 
> detail in the form?
>
> Any and all help is greatly appreciated!
>
>
> Thank you,
> Zach Calvert
>
>
>

Reply via email to