You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by lhe77 <la...@compart.net> on 2007/11/15 08:07:10 UTC

Help with http upload component

Hi,

I try to make a http uploader which processes the uploaded file and sends
back the file after processing it. 

The http consumer is defined to use In-Out MEP and it works so far that I
get the file in my processing bean. Then I fill it just for simplicity again
to the out message and send it back to the http component.

When doing so, the browser (I use a simple upload form html file) displays
the following error message:


HTTP ERROR: 500

INTERNAL_SERVER_ERROR

RequestURI=/upload/
Caused by:

javax.mail.internet.ParseException
	at javax.mail.internet.ContentType.(ContentType.java:83)
	at javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1249)
	at javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1001)
	at javax.mail.internet.MimeMultipart.updateHeaders(MimeMultipart.java:333)
	at javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1255)
	at javax.mail.internet.MimeMessage.updateHeaders(MimeMessage.java:2012)
	at javax.mail.internet.MimeMessage.saveChanges(MimeMessage.java:1980)
	at
org.apache.servicemix.soap.marshalers.SoapWriter.writeMultipartMessage(SoapWriter.java:166)
	at
org.apache.servicemix.soap.marshalers.SoapWriter.write(SoapWriter.java:90)
	at
org.apache.servicemix.http.processors.ConsumerProcessor.processResponse(ConsumerProcessor.java:222)
	at
org.apache.servicemix.http.processors.ConsumerProcessor.process(ConsumerProcessor.java:203)
	at
org.apache.servicemix.http.HttpBridgeServlet.doPost(HttpBridgeServlet.java:71)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712)
	at
org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:211)
	at
org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
	at org.mortbay.jetty.Server.handle(Server.java:313)
	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:506)
	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:375)
	at
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:396)
	at
org.mortbay.jetty.nio.SelectChannelConnector$RetryContinuation.run(SelectChannelConnector.java:511)
	at
org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)

Powered by Jetty://


I attached the whole project to that posting for better testing. The
servicemix version is 3.2 release version.

Thanks in advance for any help,
Lars


Here is the ready to compile project for testing:
http://www.nabble.com/file/p13762773/cp-http.tar.gz cp-http.tar.gz 
-- 
View this message in context: http://www.nabble.com/Help-with-http-upload-component-tf4810196s12049.html#a13762773
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Help with http upload component

Posted by Gert Vanthienen <ge...@skynet.be>.
Lars,


If you want the browser to receive the attachment file content, you 
probably need to build a custom HttpConsumerMarshaler (a new feature of 
ServiceMix 3.2).  I'm afraid that particular is currently undocumented 
on the website, but a similar feature (the new JMS consumer endpoint and 
the use of a Marshaler there) is documented on 
http://servicemix.apache.org/servicemix-jms-new-endpoints.html

The HttpConsumerMarshaler basically allows you to create your own 
MessageExchange with the HTTP request you receive and to build a custom 
HTTP response based on the MessageExchange that is returned to the 
<http:consumer/> endpoint.  You need to build a class that implements 
this interface and configure it on the <http:consumer/> enpoint.  
There's no additional documentation/examples available, so just get back 
to us if you run into problems "en cours de route".


Gert

lhe77 wrote:
> Unfortunately I am still not able to get this working.
>
> What do I want to do with it:
>
> 1. a user uploads a file using a simple upload form
> 2. when hitting the send button, the form data is send to the http-consumer
> 3. the http consumer uses InOut MEP and is forwarding the message to the
> handler bean
> 4. the handler bean is extracting the data (name and content of the file)
> 5. the handler is modifying the file contents (for example converting to
> another file format)
> 6. the handler fills the modified file to the attachment of the out message
> 7. the handler fills the content of the out message with <payload/> as dummy
> content
> 8. the handler sends the message back to the http-consumer
> 9. the browser now pops up a window to save the modified file
>
> thats it...
>
> The reality is a little different. Up to point 8 everything works fine. Step
> 9 is not working. The browser gets some multipart message but not containing
> any file content. (see the posts in this thread)
> I would expect that if I send a out message to the http-consumer, only
> containing an attachment and a dummy xml content (maybe here an empty
> content should be made allowed) that this attachment is used to put out a
> stream to the client, sending the pure file. (as a download would work)
>
> The question is now if my expectations are that wrong or is smix just not
> working as it should?
> What I try to prevent is making my own jetty binding component for that
> issue.
>
> Thanks for any advice,
> Lars
>
>   


Re: Help with http upload component

Posted by lhe77 <la...@compart.net>.
Gert,

this was exactly what I was looking for.
I managed it now to implement such a marshaler.

But still there is a problem. 
A download popup now apears, but if I save the file then, the content is
only some Java Exception.
The following exception occurs when trying to upload a pdf document.


<?xml version='1.0'
encoding='UTF-8'?><error><![CDATA[javax.activation.UnsupportedDataTypeException:
no object DCH for MIME type application/binary
	at javax.activation.DataHandler.getInputStream(DataHandler.java:247)
	at
javax.activation.DataHandlerDataSource.getInputStream(DataHandler.java:702)
	at javax.activation.DataHandler.getInputStream(DataHandler.java:237)
	at net.compart.jbi.HTTPMarshaler.sendOut(HTTPMarshaler.java:209)
	at
org.apache.servicemix.http.endpoints.HttpConsumerEndpoint.sendOut(HttpConsumerEndpoint.java:392)
	at
org.apache.servicemix.http.endpoints.HttpConsumerEndpoint.process(HttpConsumerEndpoint.java:273)
	at
org.apache.servicemix.http.HttpBridgeServlet.doPost(HttpBridgeServlet.java:71)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712)
	at
org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:211)
	at
org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
	at org.mortbay.jetty.Server.handle(Server.java:313)
	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:506)
	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:375)
	at
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:396)
	at
org.mortbay.jetty.nio.SelectChannelConnector$RetryContinuation.run(SelectChannelConnector.java:511)
	at
org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)
]]></error>


Now I really have no idea whats again going wrong there. Maybe you have an
idea?

Find the updated version here:
http://www.nabble.com/file/p13897483/cp-http.tar cp-http.tar 

Lars




Gert Vanthienen wrote:
> 
> Lars,
> 
> 
> If you want the browser to receive the attachment file content, you 
> probably need to build a custom HttpConsumerMarshaler (a new feature of 
> ServiceMix 3.2).  I'm afraid that particular is currently undocumented 
> on the website, but a similar feature (the new JMS consumer endpoint and 
> the use of a Marshaler there) is documented on 
> http://servicemix.apache.org/servicemix-jms-new-endpoints.html
> 
> The HttpConsumerMarshaler basically allows you to create your own 
> MessageExchange with the HTTP request you receive and to build a custom 
> HTTP response based on the MessageExchange that is returned to the 
> <http:consumer/> endpoint.  You need to build a class that implements 
> this interface and configure it on the <http:consumer/> enpoint.  
> There's no additional documentation/examples available, so just get back 
> to us if you run into problems "en cours de route".
> 
> 
> Gert
> 

-- 
View this message in context: http://www.nabble.com/Help-with-http-upload-component-tf4810196s12049.html#a13897483
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Help with http upload component

Posted by lhe77 <la...@compart.net>.
Unfortunately I am still not able to get this working.

What do I want to do with it:

1. a user uploads a file using a simple upload form
2. when hitting the send button, the form data is send to the http-consumer
3. the http consumer uses InOut MEP and is forwarding the message to the
handler bean
4. the handler bean is extracting the data (name and content of the file)
5. the handler is modifying the file contents (for example converting to
another file format)
6. the handler fills the modified file to the attachment of the out message
7. the handler fills the content of the out message with <payload/> as dummy
content
8. the handler sends the message back to the http-consumer
9. the browser now pops up a window to save the modified file

thats it...

The reality is a little different. Up to point 8 everything works fine. Step
9 is not working. The browser gets some multipart message but not containing
any file content. (see the posts in this thread)
I would expect that if I send a out message to the http-consumer, only
containing an attachment and a dummy xml content (maybe here an empty
content should be made allowed) that this attachment is used to put out a
stream to the client, sending the pure file. (as a download would work)

The question is now if my expectations are that wrong or is smix just not
working as it should?
What I try to prevent is making my own jetty binding component for that
issue.

Thanks for any advice,
Lars

-- 
View this message in context: http://www.nabble.com/Help-with-http-upload-component-tf4810196s12049.html#a13873100
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Help with http upload component

Posted by lhe <lr...@web.de>.
The updated version of the project:

http://www.nabble.com/file/p13803820/cp-http.tar cp-http.tar 

-- 
View this message in context: http://www.nabble.com/Help-with-http-upload-component-tf4810196s12049.html#a13803820
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Help with http upload component

Posted by lhe77 <la...@compart.net>.
I noticed an error message in the console when switching to debug mode:


DEBUG - DeliveryChannelImpl            - Send
ID:172.20.17.237-11647d81984-21:0 in DeliveryChannel{servicemix-http}
DEBUG - SedaFlow                       - Called Flow send
WARN  - jetty                          - /upload/:
javax.activation.UnsupportedDataTypeException: no object DCH for MIME type
application/pdf
DEBUG - SedaQueue                      -
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1@24d938 dequeued
exchange: InOut[


Maybe it has something to do with that message 
WARN  - jetty                          - /upload/:
javax.activation.UnsupportedDataTypeException: no object DCH for MIME type
application/pdf

LG
Lars



lhe77 wrote:
> 
> Freeman,
> 
> first of all thank you for the help. This fixed the exception.
> But another issue occured afterwards. The result is now a stream with this
> content:
> 
> 
> ------=_Part_0_21950399.1195205581181
> Content-Type: text/xml; charset=UTF-8
> Content-Transfer-Encoding: 8bit
> Content-ID: <soap-request>
> 
> <?xml version='1.0' encoding='UTF-8'?><payload />
> ------=_Part_0_21950399.1195205581181
> Content-Type: application/pdf
> Content-Transfer-Encoding: 8bit
> Content-ID: <Part0>
> 
> 
> I expected that I will receive the file now to show it or to save it
> somewhere. 
> What do I have to do for this?
> 
> Thanks in advance
> Lars
> 
> 
> 
> Freeman Fang wrote:
>> 
>> For your HandlerBean.java,
>> change
>> DataHandler dh = new DataHandler(new 
>> StreamDataSource(content.getInputStream()));
>> to
>> DataHandler dh = new DataHandler(new 
>> StreamDataSource(content.getInputStream()), content.getContentType());
>> 
>> Cheers
>> Freeman
>> 
>> lhe77 wrote:
>>> Wow, really strange thing. Maybe it got destroyed when uploading it.
>>>
>>> So this is now another try :)
>>> http://www.nabble.com/file/p13788208/cp-http.tar cp-http.tar 
>>>
>>> Thanks in advance
>>> Lars
>>>
>>>
>>>
>>>
>>> Freeman Fang wrote:
>>>   
>>>> Hi,
>>>> Can't extract the attachment you append here
>>>>
>>>> http://www.nabble.com/file/p13762773/cp-http.tar.gz
>>>>
>>>>
>>>> Freeman
>>>>
>>>> lhe77 wrote:
>>>>     
>>>>> Hi,
>>>>>
>>>>> I try to make a http uploader which processes the uploaded file and
>>>>> sends
>>>>> back the file after processing it. 
>>>>>
>>>>> The http consumer is defined to use In-Out MEP and it works so far
>>>>> that I
>>>>> get the file in my processing bean. Then I fill it just for simplicity
>>>>> again
>>>>> to the out message and send it back to the http component.
>>>>>
>>>>> When doing so, the browser (I use a simple upload form html file)
>>>>> displays
>>>>> the following error message:
>>>>>
>>>>>
>>>>> HTTP ERROR: 500
>>>>>
>>>>> INTERNAL_SERVER_ERROR
>>>>>
>>>>> RequestURI=/upload/
>>>>> Caused by:
>>>>>
>>>>> javax.mail.internet.ParseException
>>>>> 	at javax.mail.internet.ContentType.(ContentType.java:83)
>>>>> 	at
>>>>> javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1249)
>>>>> 	at
>>>>> javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1001)
>>>>> 	at
>>>>> javax.mail.internet.MimeMultipart.updateHeaders(MimeMultipart.java:333)
>>>>> 	at
>>>>> javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1255)
>>>>> 	at
>>>>> javax.mail.internet.MimeMessage.updateHeaders(MimeMessage.java:2012)
>>>>> 	at javax.mail.internet.MimeMessage.saveChanges(MimeMessage.java:1980)
>>>>> 	at
>>>>> org.apache.servicemix.soap.marshalers.SoapWriter.writeMultipartMessage(SoapWriter.java:166)
>>>>> 	at
>>>>> org.apache.servicemix.soap.marshalers.SoapWriter.write(SoapWriter.java:90)
>>>>> 	at
>>>>> org.apache.servicemix.http.processors.ConsumerProcessor.processResponse(ConsumerProcessor.java:222)
>>>>> 	at
>>>>> org.apache.servicemix.http.processors.ConsumerProcessor.process(ConsumerProcessor.java:203)
>>>>> 	at
>>>>> org.apache.servicemix.http.HttpBridgeServlet.doPost(HttpBridgeServlet.java:71)
>>>>> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
>>>>> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
>>>>> 	at
>>>>> org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
>>>>> 	at
>>>>> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
>>>>> 	at
>>>>> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712)
>>>>> 	at
>>>>> org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:211)
>>>>> 	at
>>>>> org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
>>>>> 	at
>>>>> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
>>>>> 	at org.mortbay.jetty.Server.handle(Server.java:313)
>>>>> 	at
>>>>> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:506)
>>>>> 	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:375)
>>>>> 	at
>>>>> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:396)
>>>>> 	at
>>>>> org.mortbay.jetty.nio.SelectChannelConnector$RetryContinuation.run(SelectChannelConnector.java:511)
>>>>> 	at
>>>>> org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)
>>>>>
>>>>> Powered by Jetty://
>>>>>
>>>>>
>>>>> I attached the whole project to that posting for better testing. The
>>>>> servicemix version is 3.2 release version.
>>>>>
>>>>> Thanks in advance for any help,
>>>>> Lars
>>>>>
>>>>>
>>>>> Here is the ready to compile project for testing:
>>>>> http://www.nabble.com/file/p13762773/cp-http.tar.gz cp-http.tar.gz 
>>>>>   
>>>>>       
>>>>     
>>>
>>>   
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Help-with-http-upload-component-tf4810196s12049.html#a13791430
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Help with http upload component

Posted by lhe77 <la...@compart.net>.
Freeman,

first of all thank you for the help. This fixed the exception.
But another issue occured afterwards. The result is now a stream with this
content:


------=_Part_0_21950399.1195205581181
Content-Type: text/xml; charset=UTF-8
Content-Transfer-Encoding: 8bit
Content-ID: <soap-request>

<?xml version='1.0' encoding='UTF-8'?><payload />
------=_Part_0_21950399.1195205581181
Content-Type: application/pdf
Content-Transfer-Encoding: 8bit
Content-ID: <Part0>


I expected that I will receive the file now to show it or to save it
somewhere. 
What do I have to do for this?

Thanks in advance
Lars



Freeman Fang wrote:
> 
> For your HandlerBean.java,
> change
> DataHandler dh = new DataHandler(new 
> StreamDataSource(content.getInputStream()));
> to
> DataHandler dh = new DataHandler(new 
> StreamDataSource(content.getInputStream()), content.getContentType());
> 
> Cheers
> Freeman
> 
> lhe77 wrote:
>> Wow, really strange thing. Maybe it got destroyed when uploading it.
>>
>> So this is now another try :)
>> http://www.nabble.com/file/p13788208/cp-http.tar cp-http.tar 
>>
>> Thanks in advance
>> Lars
>>
>>
>>
>>
>> Freeman Fang wrote:
>>   
>>> Hi,
>>> Can't extract the attachment you append here
>>>
>>> http://www.nabble.com/file/p13762773/cp-http.tar.gz
>>>
>>>
>>> Freeman
>>>
>>> lhe77 wrote:
>>>     
>>>> Hi,
>>>>
>>>> I try to make a http uploader which processes the uploaded file and
>>>> sends
>>>> back the file after processing it. 
>>>>
>>>> The http consumer is defined to use In-Out MEP and it works so far that
>>>> I
>>>> get the file in my processing bean. Then I fill it just for simplicity
>>>> again
>>>> to the out message and send it back to the http component.
>>>>
>>>> When doing so, the browser (I use a simple upload form html file)
>>>> displays
>>>> the following error message:
>>>>
>>>>
>>>> HTTP ERROR: 500
>>>>
>>>> INTERNAL_SERVER_ERROR
>>>>
>>>> RequestURI=/upload/
>>>> Caused by:
>>>>
>>>> javax.mail.internet.ParseException
>>>> 	at javax.mail.internet.ContentType.(ContentType.java:83)
>>>> 	at
>>>> javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1249)
>>>> 	at
>>>> javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1001)
>>>> 	at
>>>> javax.mail.internet.MimeMultipart.updateHeaders(MimeMultipart.java:333)
>>>> 	at
>>>> javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1255)
>>>> 	at
>>>> javax.mail.internet.MimeMessage.updateHeaders(MimeMessage.java:2012)
>>>> 	at javax.mail.internet.MimeMessage.saveChanges(MimeMessage.java:1980)
>>>> 	at
>>>> org.apache.servicemix.soap.marshalers.SoapWriter.writeMultipartMessage(SoapWriter.java:166)
>>>> 	at
>>>> org.apache.servicemix.soap.marshalers.SoapWriter.write(SoapWriter.java:90)
>>>> 	at
>>>> org.apache.servicemix.http.processors.ConsumerProcessor.processResponse(ConsumerProcessor.java:222)
>>>> 	at
>>>> org.apache.servicemix.http.processors.ConsumerProcessor.process(ConsumerProcessor.java:203)
>>>> 	at
>>>> org.apache.servicemix.http.HttpBridgeServlet.doPost(HttpBridgeServlet.java:71)
>>>> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
>>>> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
>>>> 	at
>>>> org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
>>>> 	at
>>>> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
>>>> 	at
>>>> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712)
>>>> 	at
>>>> org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:211)
>>>> 	at
>>>> org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
>>>> 	at
>>>> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
>>>> 	at org.mortbay.jetty.Server.handle(Server.java:313)
>>>> 	at
>>>> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:506)
>>>> 	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:375)
>>>> 	at
>>>> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:396)
>>>> 	at
>>>> org.mortbay.jetty.nio.SelectChannelConnector$RetryContinuation.run(SelectChannelConnector.java:511)
>>>> 	at
>>>> org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)
>>>>
>>>> Powered by Jetty://
>>>>
>>>>
>>>> I attached the whole project to that posting for better testing. The
>>>> servicemix version is 3.2 release version.
>>>>
>>>> Thanks in advance for any help,
>>>> Lars
>>>>
>>>>
>>>> Here is the ready to compile project for testing:
>>>> http://www.nabble.com/file/p13762773/cp-http.tar.gz cp-http.tar.gz 
>>>>   
>>>>       
>>>     
>>
>>   
> 
> 

-- 
View this message in context: http://www.nabble.com/Help-with-http-upload-component-tf4810196s12049.html#a13790060
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Help with http upload component

Posted by Freeman Fang <fr...@gmail.com>.
For your HandlerBean.java,
change
DataHandler dh = new DataHandler(new 
StreamDataSource(content.getInputStream()));
to
DataHandler dh = new DataHandler(new 
StreamDataSource(content.getInputStream()), content.getContentType());

Cheers
Freeman

lhe77 wrote:
> Wow, really strange thing. Maybe it got destroyed when uploading it.
>
> So this is now another try :)
> http://www.nabble.com/file/p13788208/cp-http.tar cp-http.tar 
>
> Thanks in advance
> Lars
>
>
>
>
> Freeman Fang wrote:
>   
>> Hi,
>> Can't extract the attachment you append here
>>
>> http://www.nabble.com/file/p13762773/cp-http.tar.gz
>>
>>
>> Freeman
>>
>> lhe77 wrote:
>>     
>>> Hi,
>>>
>>> I try to make a http uploader which processes the uploaded file and sends
>>> back the file after processing it. 
>>>
>>> The http consumer is defined to use In-Out MEP and it works so far that I
>>> get the file in my processing bean. Then I fill it just for simplicity
>>> again
>>> to the out message and send it back to the http component.
>>>
>>> When doing so, the browser (I use a simple upload form html file)
>>> displays
>>> the following error message:
>>>
>>>
>>> HTTP ERROR: 500
>>>
>>> INTERNAL_SERVER_ERROR
>>>
>>> RequestURI=/upload/
>>> Caused by:
>>>
>>> javax.mail.internet.ParseException
>>> 	at javax.mail.internet.ContentType.(ContentType.java:83)
>>> 	at
>>> javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1249)
>>> 	at
>>> javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1001)
>>> 	at
>>> javax.mail.internet.MimeMultipart.updateHeaders(MimeMultipart.java:333)
>>> 	at
>>> javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1255)
>>> 	at javax.mail.internet.MimeMessage.updateHeaders(MimeMessage.java:2012)
>>> 	at javax.mail.internet.MimeMessage.saveChanges(MimeMessage.java:1980)
>>> 	at
>>> org.apache.servicemix.soap.marshalers.SoapWriter.writeMultipartMessage(SoapWriter.java:166)
>>> 	at
>>> org.apache.servicemix.soap.marshalers.SoapWriter.write(SoapWriter.java:90)
>>> 	at
>>> org.apache.servicemix.http.processors.ConsumerProcessor.processResponse(ConsumerProcessor.java:222)
>>> 	at
>>> org.apache.servicemix.http.processors.ConsumerProcessor.process(ConsumerProcessor.java:203)
>>> 	at
>>> org.apache.servicemix.http.HttpBridgeServlet.doPost(HttpBridgeServlet.java:71)
>>> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
>>> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
>>> 	at
>>> org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
>>> 	at
>>> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
>>> 	at
>>> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712)
>>> 	at
>>> org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:211)
>>> 	at
>>> org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
>>> 	at
>>> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
>>> 	at org.mortbay.jetty.Server.handle(Server.java:313)
>>> 	at
>>> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:506)
>>> 	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:375)
>>> 	at
>>> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:396)
>>> 	at
>>> org.mortbay.jetty.nio.SelectChannelConnector$RetryContinuation.run(SelectChannelConnector.java:511)
>>> 	at
>>> org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)
>>>
>>> Powered by Jetty://
>>>
>>>
>>> I attached the whole project to that posting for better testing. The
>>> servicemix version is 3.2 release version.
>>>
>>> Thanks in advance for any help,
>>> Lars
>>>
>>>
>>> Here is the ready to compile project for testing:
>>> http://www.nabble.com/file/p13762773/cp-http.tar.gz cp-http.tar.gz 
>>>   
>>>       
>>     
>
>   

Re: Help with http upload component

Posted by lhe77 <la...@compart.net>.
Wow, really strange thing. Maybe it got destroyed when uploading it.

So this is now another try :)
http://www.nabble.com/file/p13788208/cp-http.tar cp-http.tar 

Thanks in advance
Lars




Freeman Fang wrote:
> 
> Hi,
> Can't extract the attachment you append here
> 
> http://www.nabble.com/file/p13762773/cp-http.tar.gz
> 
> 
> Freeman
> 
> lhe77 wrote:
>> Hi,
>>
>> I try to make a http uploader which processes the uploaded file and sends
>> back the file after processing it. 
>>
>> The http consumer is defined to use In-Out MEP and it works so far that I
>> get the file in my processing bean. Then I fill it just for simplicity
>> again
>> to the out message and send it back to the http component.
>>
>> When doing so, the browser (I use a simple upload form html file)
>> displays
>> the following error message:
>>
>>
>> HTTP ERROR: 500
>>
>> INTERNAL_SERVER_ERROR
>>
>> RequestURI=/upload/
>> Caused by:
>>
>> javax.mail.internet.ParseException
>> 	at javax.mail.internet.ContentType.(ContentType.java:83)
>> 	at
>> javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1249)
>> 	at
>> javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1001)
>> 	at
>> javax.mail.internet.MimeMultipart.updateHeaders(MimeMultipart.java:333)
>> 	at
>> javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1255)
>> 	at javax.mail.internet.MimeMessage.updateHeaders(MimeMessage.java:2012)
>> 	at javax.mail.internet.MimeMessage.saveChanges(MimeMessage.java:1980)
>> 	at
>> org.apache.servicemix.soap.marshalers.SoapWriter.writeMultipartMessage(SoapWriter.java:166)
>> 	at
>> org.apache.servicemix.soap.marshalers.SoapWriter.write(SoapWriter.java:90)
>> 	at
>> org.apache.servicemix.http.processors.ConsumerProcessor.processResponse(ConsumerProcessor.java:222)
>> 	at
>> org.apache.servicemix.http.processors.ConsumerProcessor.process(ConsumerProcessor.java:203)
>> 	at
>> org.apache.servicemix.http.HttpBridgeServlet.doPost(HttpBridgeServlet.java:71)
>> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
>> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
>> 	at
>> org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
>> 	at
>> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
>> 	at
>> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712)
>> 	at
>> org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:211)
>> 	at
>> org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
>> 	at
>> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
>> 	at org.mortbay.jetty.Server.handle(Server.java:313)
>> 	at
>> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:506)
>> 	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:375)
>> 	at
>> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:396)
>> 	at
>> org.mortbay.jetty.nio.SelectChannelConnector$RetryContinuation.run(SelectChannelConnector.java:511)
>> 	at
>> org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)
>>
>> Powered by Jetty://
>>
>>
>> I attached the whole project to that posting for better testing. The
>> servicemix version is 3.2 release version.
>>
>> Thanks in advance for any help,
>> Lars
>>
>>
>> Here is the ready to compile project for testing:
>> http://www.nabble.com/file/p13762773/cp-http.tar.gz cp-http.tar.gz 
>>   
> 
> 

-- 
View this message in context: http://www.nabble.com/Help-with-http-upload-component-tf4810196s12049.html#a13788208
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Help with http upload component

Posted by Freeman Fang <fr...@gmail.com>.
Hi,
Can't extract the attachment you append here

http://www.nabble.com/file/p13762773/cp-http.tar.gz


Freeman

lhe77 wrote:
> Hi,
>
> I try to make a http uploader which processes the uploaded file and sends
> back the file after processing it. 
>
> The http consumer is defined to use In-Out MEP and it works so far that I
> get the file in my processing bean. Then I fill it just for simplicity again
> to the out message and send it back to the http component.
>
> When doing so, the browser (I use a simple upload form html file) displays
> the following error message:
>
>
> HTTP ERROR: 500
>
> INTERNAL_SERVER_ERROR
>
> RequestURI=/upload/
> Caused by:
>
> javax.mail.internet.ParseException
> 	at javax.mail.internet.ContentType.(ContentType.java:83)
> 	at javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1249)
> 	at javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1001)
> 	at javax.mail.internet.MimeMultipart.updateHeaders(MimeMultipart.java:333)
> 	at javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1255)
> 	at javax.mail.internet.MimeMessage.updateHeaders(MimeMessage.java:2012)
> 	at javax.mail.internet.MimeMessage.saveChanges(MimeMessage.java:1980)
> 	at
> org.apache.servicemix.soap.marshalers.SoapWriter.writeMultipartMessage(SoapWriter.java:166)
> 	at
> org.apache.servicemix.soap.marshalers.SoapWriter.write(SoapWriter.java:90)
> 	at
> org.apache.servicemix.http.processors.ConsumerProcessor.processResponse(ConsumerProcessor.java:222)
> 	at
> org.apache.servicemix.http.processors.ConsumerProcessor.process(ConsumerProcessor.java:203)
> 	at
> org.apache.servicemix.http.HttpBridgeServlet.doPost(HttpBridgeServlet.java:71)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
> 	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
> 	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
> 	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712)
> 	at
> org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:211)
> 	at
> org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
> 	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
> 	at org.mortbay.jetty.Server.handle(Server.java:313)
> 	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:506)
> 	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:375)
> 	at
> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:396)
> 	at
> org.mortbay.jetty.nio.SelectChannelConnector$RetryContinuation.run(SelectChannelConnector.java:511)
> 	at
> org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)
>
> Powered by Jetty://
>
>
> I attached the whole project to that posting for better testing. The
> servicemix version is 3.2 release version.
>
> Thanks in advance for any help,
> Lars
>
>
> Here is the ready to compile project for testing:
> http://www.nabble.com/file/p13762773/cp-http.tar.gz cp-http.tar.gz 
>   

Re: No ideas?

Posted by Bruce Snyder <br...@gmail.com>.
On Dec 2, 2007 4:17 AM, lhe <lr...@web.de> wrote:
>
> Bruce,
>
> Gert helped me out with that. It's now fixed.
> I made a tutorial for this use case. Just see the documentation.

Ah, yes. For anyone wishing to create an application that uploads PDF
documents, Lars has written a very nice tutorial is here:

http://servicemix.apache.org/4-beginner-writing-a-http-upload-application.html

Bruce
-- 
perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache ActiveMQ - http://activemq.org/
Apache ServiceMix - http://servicemix.org/
Apache Geronimo - http://geronimo.apache.org/
Castor - http://castor.org/

Re: No ideas?

Posted by lhe <lr...@web.de>.
Bruce,

Gert helped me out with that. It's now fixed. 
I made a tutorial for this use case. Just see the documentation.

Regards
Lars



bsnyder wrote:
> 
> On Nov 15, 2007 11:29 PM, lhe77 <la...@compart.net> wrote:
>>
>> I am wondering that nobody got a idea to help me with my issue.
>> Thought this is some basic functionality of servicemix http component but
>> now it seems somewhat complicated.
> 
> You got this fixed, correct?
> 
> Bruce
> -- 
> perl -e 'print
> unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
> );'
> 
> Apache ActiveMQ - http://activemq.org/
> Apache ServiceMix - http://servicemix.org/
> Apache Geronimo - http://geronimo.apache.org/
> Castor - http://castor.org/
> 
> 

-- 
View this message in context: http://www.nabble.com/Help-with-http-upload-component-tf4810196s12049.html#a14114416
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: No ideas?

Posted by Bruce Snyder <br...@gmail.com>.
On Nov 15, 2007 11:29 PM, lhe77 <la...@compart.net> wrote:
>
> I am wondering that nobody got a idea to help me with my issue.
> Thought this is some basic functionality of servicemix http component but
> now it seems somewhat complicated.

You got this fixed, correct?

Bruce
-- 
perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache ActiveMQ - http://activemq.org/
Apache ServiceMix - http://servicemix.org/
Apache Geronimo - http://geronimo.apache.org/
Castor - http://castor.org/

No ideas?

Posted by lhe77 <la...@compart.net>.
I am wondering that nobody got a idea to help me with my issue.
Thought this is some basic functionality of servicemix http component but
now it seems somewhat complicated.

Please have a look at it.
Lars



-- 
View this message in context: http://www.nabble.com/Help-with-http-upload-component-tf4810196s12049.html#a13787981
Sent from the ServiceMix - User mailing list archive at Nabble.com.