You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Stefan Klinger <kl...@cs.york.ac.uk> on 2006/03/22 13:52:30 UTC
FileUpload via Http
Hello all,
I am trying to include a file upload facility using http within my
project. Unfortunately, my file is not an xml document, so it should be
treated as an attachment. If I am correct, the HttpMarshaler only
accepts xml documents which are set to the message content. Would there
be a way to accept non-xml files and set them as message attachments
(similar to the SaajMarshaler)? Or is there another, more elegant way of
doing this?
Thanks,
Stefan
Re: FileUpload via Http
Posted by Stefan Klinger <kl...@cs.york.ac.uk>.
Thank you Guillaume, this works nicely...
Guillaume Nodet wrote:
>Have you tried using a provider endpoint on servicemix-http component as shown
>in http://servicemix.org/servicemix-http ? The lightweight component
>(o.a.s.components.http.HttpInvoker) does not handle MIME attachments
>as you noticed.
>
>Cheers,
>Guillaume Nodet
>
>On 3/23/06, Stefan Klinger <kl...@cs.york.ac.uk> wrote:
>
>
>>Guillaume,
>>
>>I can see that the multipart/ contents is working fine from http -> jbi.
>>However, I now would like to convert that message back from jbi ->
>>http. However, it seems like the HttpClientMarshaler is ignoring the
>>MIME attachments of the jbi message. Is it possible to add that
>>functionality as well?
>>
>>Thanks,
>>Stefan
>>
>>Guillaume Nodet wrote:
>>
>>
>>
>>>On 3/23/06, Stefan Klinger <kl...@cs.york.ac.uk> wrote:
>>>
>>>
>>>
>>>
>>>>Guillaume,
>>>>Thanks for the very quick fix of this issue (And sorry for adding the
>>>>jira again :-[ ). It seems to work fine now.
>>>>
>>>>
>>>>
>>>>
>>>No problem. As I wanted to commit the fix, I had to create the JIRA ...
>>>
>>>
>>>
>>>
>>>
>>>>Just a quick question - the first part needs to be an xml file. My guess
>>>>is that the reason for doing this is that you convert the mime message
>>>>to a soap message before converting it into a jbi message, and the soap
>>>>message requires a xml source. For me personally, it is not always
>>>>convenient to have the first part (or any part) being an xml document
>>>>for legacy reasons. But I am sure I will find a workaround for it.
>>>>
>>>>
>>>>
>>>>
>>>The main reason is that ServiceMix does not work well when no xml content
>>>is set on the message. This could be improved...
>>>If you don't use it, just send a dummy xml, like <dummy/>. It will do
>>>the trick.
>>>
>>>Cheers,
>>>Guillaume Nodet
>>>
>>>
>>>
>>>
>>>
>>>>Thanks again for the very quick fix.
>>>>Stefan
>>>>
>>>>
>>>>Guillaume Nodet wrote:
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>>This should works now. FYI, the first mime part will be used as the
>>>>>xml payload content, so that you will need to send a valid xml in it
>>>>>(event some dummy xml).
>>>>>
>>>>>Cheers,
>>>>>Guillaume Nodet
>>>>>
>>>>>On 3/22/06, Stefan Klinger <kl...@cs.york.ac.uk> wrote:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>Thanks for the reply Guillaume.
>>>>>>
>>>>>>It would be great (for me) if the other multipart contents were
>>>>>>supported as part of SM as well.
>>>>>>
>>>>>>Thanks again and keep up the good work!
>>>>>>Stefan
>>>>>>
>>>>>>Guillaume Nodet wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>>Currently, only multipart/related mime type (RFC2387) is supported.
>>>>>>>Other multipart contents are not supported :(
>>>>>>>This includes
>>>>>>>* multipart/mixed (RFC1521)
>>>>>>>* multipart/formdata (RFC1867)
>>>>>>>
>>>>>>>I'm trying to see if it is possible to support them.
>>>>>>>
>>>>>>>Cheers,
>>>>>>>Guillaume Nodet
>>>>>>>
>>>>>>>On 3/22/06, Stefan Klinger <kl...@cs.york.ac.uk> wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>Thanks Guillaume,
>>>>>>>>
>>>>>>>>I have tried using the HttpComponent, but it threw an exception in the
>>>>>>>>DeliveryChannel and ReceiverComponent. My client code is the following:
>>>>>>>>
>>>>>>>> File f = new File("some_file.txt");
>>>>>>>> PostMethod filePost = new
>>>>>>>>PostMethod("http://localhost:8192/Service/");
>>>>>>>> Part[] parts = { new StringPart("param_name", "value"),
>>>>>>>> new FilePart(f.getName(), f) };
>>>>>>>> filePost.setRequestEntity(
>>>>>>>> new MultipartRequestEntity(parts, filePost.getParams()) );
>>>>>>>> HttpClient client = new HttpClient();
>>>>>>>> int status = client.executeMethod(filePost);
>>>>>>>> filePost.releaseConnection();
>>>>>>>>
>>>>>>>>and my XmlBeans configuration file is the following
>>>>>>>>
>>>>>>>> <sm:activationSpec>
>>>>>>>> <sm:component>
>>>>>>>> <http:component>
>>>>>>>> <http:endpoints>
>>>>>>>> <http:endpoint service="test:MyConsumerService"
>>>>>>>> endpoint="myConsumer"
>>>>>>>> role="consumer"
>>>>>>>>
>>>>>>>>locationURI="http://localhost:8192/Service/"
>>>>>>>>
>>>>>>>>defaultMep="http://www.w3.org/2004/08/wsdl/in-only" />
>>>>>>>> </http:endpoints>
>>>>>>>> </http:component>
>>>>>>>> </sm:component>
>>>>>>>> </sm:activationSpec>
>>>>>>>>
>>>>>>>> <sm:activationSpec service="test:MyConsumerService"
>>>>>>>>endpoint="myConsumer">
>>>>>>>> <sm:component>
>>>>>>>> <bean class="org.apache.servicemix.tck.ReceiverComponent" />
>>>>>>>> </sm:component>
>>>>>>>> </sm:activationSpec>
>>>>>>>>
>>>>>>>>and I get the following exceptions
>>>>>>>>
>>>>>>>>[edThreadPool0-1] DEBUG DeliveryChannel - Unable to
>>>>>>>>display message
>>>>>>>>org.xml.sax.SAXParseException: Content is not allowed in prolog.
>>>>>>>> at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
>>>>>>>> at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
>>>>>>>> at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:123)
>>>>>>>> at
>>>>>>>>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSourceFromStream(SourceTransformer.java:221)
>>>>>>>> at
>>>>>>>>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSource(SourceTransformer.java:136)
>>>>>>>> at
>>>>>>>>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMNode(SourceTransformer.java:275)
>>>>>>>> at
>>>>>>>>org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.traceMessageExchange(DeliveryChannelImpl.java:297)
>>>>>>>> at
>>>>>>>>org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(DeliveryChannelImpl.java:388)
>>>>>>>> at
>>>>>>>>org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(DeliveryChannelImpl.java:490)
>>>>>>>> at
>>>>>>>>org.apache.servicemix.common.BaseLifeCycle.sendConsumerExchange(BaseLifeCycle.java:389)
>>>>>>>> at
>>>>>>>>org.apache.servicemix.http.processors.ConsumerProcessor.process(ConsumerProcessor.java:131)
>>>>>>>> at
>>>>>>>>org.apache.servicemix.http.HttpBridgeServlet.doPost(HttpBridgeServlet.java:70)
>>>>>>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:615)
>>>>>>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
>>>>>>>>
>>>>>>>>SEVERE: org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1@1c66ec7 got
>>>>>>>>error processing org.apache.servicemix.jbi.messaging.InOnlyImpl@92eb86
>>>>>>>>javax.jbi.messaging.MessagingException: org.xml.sax.SAXParseException:
>>>>>>>>Content is not allowed in prolog.
>>>>>>>> at
>>>>>>>>org.apache.servicemix.components.util.CopyTransformer.transform(CopyTransformer.java:80)
>>>>>>>> at
>>>>>>>>org.apache.servicemix.tck.ReceiverComponent.onMessageExchange(ReceiverComponent.java:47)
>>>>>>>> at
>>>>>>>>org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:636)
>>>>>>>> at
>>>>>>>>org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:171)
>>>>>>>> at
>>>>>>>>org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:221)
>>>>>>>> at
>>>>>>>>org.apache.geronimo.connector.work.WorkerContext.run(WorkerContext.java:291)
>>>>>>>> at
>>>>>>>>EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(Unknown Source)
>>>>>>>> at java.lang.Thread.run(Thread.java:595)
>>>>>>>>Caused by: org.xml.sax.SAXParseException: Content is not allowed in prolog.
>>>>>>>> at
>>>>>>>>com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:264)
>>>>>>>> at
>>>>>>>>com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:292)
>>>>>>>> at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:123)
>>>>>>>> at
>>>>>>>>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSourceFromStream(SourceTransformer.java:221)
>>>>>>>> at
>>>>>>>>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSource(SourceTransformer.java:136)
>>>>>>>> at
>>>>>>>>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMNode(SourceTransformer.java:275)
>>>>>>>> at
>>>>>>>>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMNode(SourceTransformer.java:302)
>>>>>>>> at
>>>>>>>>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSource(SourceTransformer.java:144)
>>>>>>>> at
>>>>>>>>org.apache.servicemix.components.util.CopyTransformer.transform(CopyTransformer.java:68)
>>>>>>>> ... 7 more
>>>>>>>>
>>>>>>>>Thanks,
>>>>>>>>Stefan
>>>>>>>>
>>>>>>>>Guillaume Nodet wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>>The servicemix-http component handles MIME attachments.
>>>>>>>>>You should give it a try.
>>>>>>>>>
>>>>>>>>>Cheers,
>>>>>>>>>Guillaume Nodet
>>>>>>>>>
>>>>>>>>>On 3/22/06, Stefan Klinger <kl...@cs.york.ac.uk> wrote:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>>Hello all,
>>>>>>>>>>
>>>>>>>>>>I am trying to include a file upload facility using http within my
>>>>>>>>>>project. Unfortunately, my file is not an xml document, so it should be
>>>>>>>>>>treated as an attachment. If I am correct, the HttpMarshaler only
>>>>>>>>>>accepts xml documents which are set to the message content. Would there
>>>>>>>>>>be a way to accept non-xml files and set them as message attachments
>>>>>>>>>>(similar to the SaajMarshaler)? Or is there another, more elegant way of
>>>>>>>>>>doing this?
>>>>>>>>>>
>>>>>>>>>>Thanks,
>>>>>>>>>>Stefan
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>
>>>>>>
>>>>
>>>>
>>>
>>>
>>>
>>
>>
Re: FileUpload via Http
Posted by Guillaume Nodet <gn...@gmail.com>.
Have you tried using a provider endpoint on servicemix-http component as shown
in http://servicemix.org/servicemix-http ? The lightweight component
(o.a.s.components.http.HttpInvoker) does not handle MIME attachments
as you noticed.
Cheers,
Guillaume Nodet
On 3/23/06, Stefan Klinger <kl...@cs.york.ac.uk> wrote:
> Guillaume,
>
> I can see that the multipart/ contents is working fine from http -> jbi.
> However, I now would like to convert that message back from jbi ->
> http. However, it seems like the HttpClientMarshaler is ignoring the
> MIME attachments of the jbi message. Is it possible to add that
> functionality as well?
>
> Thanks,
> Stefan
>
> Guillaume Nodet wrote:
>
> >On 3/23/06, Stefan Klinger <kl...@cs.york.ac.uk> wrote:
> >
> >
> >>Guillaume,
> >>Thanks for the very quick fix of this issue (And sorry for adding the
> >>jira again :-[ ). It seems to work fine now.
> >>
> >>
> >
> >No problem. As I wanted to commit the fix, I had to create the JIRA ...
> >
> >
> >
> >>Just a quick question - the first part needs to be an xml file. My guess
> >>is that the reason for doing this is that you convert the mime message
> >>to a soap message before converting it into a jbi message, and the soap
> >>message requires a xml source. For me personally, it is not always
> >>convenient to have the first part (or any part) being an xml document
> >>for legacy reasons. But I am sure I will find a workaround for it.
> >>
> >>
> >
> >The main reason is that ServiceMix does not work well when no xml content
> >is set on the message. This could be improved...
> >If you don't use it, just send a dummy xml, like <dummy/>. It will do
> >the trick.
> >
> >Cheers,
> >Guillaume Nodet
> >
> >
> >
> >>Thanks again for the very quick fix.
> >>Stefan
> >>
> >>
> >>Guillaume Nodet wrote:
> >>
> >>
> >>
> >>>This should works now. FYI, the first mime part will be used as the
> >>>xml payload content, so that you will need to send a valid xml in it
> >>>(event some dummy xml).
> >>>
> >>>Cheers,
> >>>Guillaume Nodet
> >>>
> >>>On 3/22/06, Stefan Klinger <kl...@cs.york.ac.uk> wrote:
> >>>
> >>>
> >>>
> >>>
> >>>>Thanks for the reply Guillaume.
> >>>>
> >>>>It would be great (for me) if the other multipart contents were
> >>>>supported as part of SM as well.
> >>>>
> >>>>Thanks again and keep up the good work!
> >>>>Stefan
> >>>>
> >>>>Guillaume Nodet wrote:
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>>Currently, only multipart/related mime type (RFC2387) is supported.
> >>>>>Other multipart contents are not supported :(
> >>>>>This includes
> >>>>>* multipart/mixed (RFC1521)
> >>>>>* multipart/formdata (RFC1867)
> >>>>>
> >>>>>I'm trying to see if it is possible to support them.
> >>>>>
> >>>>>Cheers,
> >>>>>Guillaume Nodet
> >>>>>
> >>>>>On 3/22/06, Stefan Klinger <kl...@cs.york.ac.uk> wrote:
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>>Thanks Guillaume,
> >>>>>>
> >>>>>>I have tried using the HttpComponent, but it threw an exception in the
> >>>>>>DeliveryChannel and ReceiverComponent. My client code is the following:
> >>>>>>
> >>>>>> File f = new File("some_file.txt");
> >>>>>> PostMethod filePost = new
> >>>>>>PostMethod("http://localhost:8192/Service/");
> >>>>>> Part[] parts = { new StringPart("param_name", "value"),
> >>>>>> new FilePart(f.getName(), f) };
> >>>>>> filePost.setRequestEntity(
> >>>>>> new MultipartRequestEntity(parts, filePost.getParams()) );
> >>>>>> HttpClient client = new HttpClient();
> >>>>>> int status = client.executeMethod(filePost);
> >>>>>> filePost.releaseConnection();
> >>>>>>
> >>>>>>and my XmlBeans configuration file is the following
> >>>>>>
> >>>>>> <sm:activationSpec>
> >>>>>> <sm:component>
> >>>>>> <http:component>
> >>>>>> <http:endpoints>
> >>>>>> <http:endpoint service="test:MyConsumerService"
> >>>>>> endpoint="myConsumer"
> >>>>>> role="consumer"
> >>>>>>
> >>>>>>locationURI="http://localhost:8192/Service/"
> >>>>>>
> >>>>>>defaultMep="http://www.w3.org/2004/08/wsdl/in-only" />
> >>>>>> </http:endpoints>
> >>>>>> </http:component>
> >>>>>> </sm:component>
> >>>>>> </sm:activationSpec>
> >>>>>>
> >>>>>> <sm:activationSpec service="test:MyConsumerService"
> >>>>>>endpoint="myConsumer">
> >>>>>> <sm:component>
> >>>>>> <bean class="org.apache.servicemix.tck.ReceiverComponent" />
> >>>>>> </sm:component>
> >>>>>> </sm:activationSpec>
> >>>>>>
> >>>>>>and I get the following exceptions
> >>>>>>
> >>>>>>[edThreadPool0-1] DEBUG DeliveryChannel - Unable to
> >>>>>>display message
> >>>>>>org.xml.sax.SAXParseException: Content is not allowed in prolog.
> >>>>>> at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
> >>>>>> at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
> >>>>>> at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:123)
> >>>>>> at
> >>>>>>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSourceFromStream(SourceTransformer.java:221)
> >>>>>> at
> >>>>>>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSource(SourceTransformer.java:136)
> >>>>>> at
> >>>>>>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMNode(SourceTransformer.java:275)
> >>>>>> at
> >>>>>>org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.traceMessageExchange(DeliveryChannelImpl.java:297)
> >>>>>> at
> >>>>>>org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(DeliveryChannelImpl.java:388)
> >>>>>> at
> >>>>>>org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(DeliveryChannelImpl.java:490)
> >>>>>> at
> >>>>>>org.apache.servicemix.common.BaseLifeCycle.sendConsumerExchange(BaseLifeCycle.java:389)
> >>>>>> at
> >>>>>>org.apache.servicemix.http.processors.ConsumerProcessor.process(ConsumerProcessor.java:131)
> >>>>>> at
> >>>>>>org.apache.servicemix.http.HttpBridgeServlet.doPost(HttpBridgeServlet.java:70)
> >>>>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:615)
> >>>>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
> >>>>>>
> >>>>>>SEVERE: org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1@1c66ec7 got
> >>>>>>error processing org.apache.servicemix.jbi.messaging.InOnlyImpl@92eb86
> >>>>>>javax.jbi.messaging.MessagingException: org.xml.sax.SAXParseException:
> >>>>>>Content is not allowed in prolog.
> >>>>>> at
> >>>>>>org.apache.servicemix.components.util.CopyTransformer.transform(CopyTransformer.java:80)
> >>>>>> at
> >>>>>>org.apache.servicemix.tck.ReceiverComponent.onMessageExchange(ReceiverComponent.java:47)
> >>>>>> at
> >>>>>>org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:636)
> >>>>>> at
> >>>>>>org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:171)
> >>>>>> at
> >>>>>>org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:221)
> >>>>>> at
> >>>>>>org.apache.geronimo.connector.work.WorkerContext.run(WorkerContext.java:291)
> >>>>>> at
> >>>>>>EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(Unknown Source)
> >>>>>> at java.lang.Thread.run(Thread.java:595)
> >>>>>>Caused by: org.xml.sax.SAXParseException: Content is not allowed in prolog.
> >>>>>> at
> >>>>>>com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:264)
> >>>>>> at
> >>>>>>com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:292)
> >>>>>> at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:123)
> >>>>>> at
> >>>>>>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSourceFromStream(SourceTransformer.java:221)
> >>>>>> at
> >>>>>>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSource(SourceTransformer.java:136)
> >>>>>> at
> >>>>>>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMNode(SourceTransformer.java:275)
> >>>>>> at
> >>>>>>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMNode(SourceTransformer.java:302)
> >>>>>> at
> >>>>>>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSource(SourceTransformer.java:144)
> >>>>>> at
> >>>>>>org.apache.servicemix.components.util.CopyTransformer.transform(CopyTransformer.java:68)
> >>>>>> ... 7 more
> >>>>>>
> >>>>>>Thanks,
> >>>>>>Stefan
> >>>>>>
> >>>>>>Guillaume Nodet wrote:
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>>The servicemix-http component handles MIME attachments.
> >>>>>>>You should give it a try.
> >>>>>>>
> >>>>>>>Cheers,
> >>>>>>>Guillaume Nodet
> >>>>>>>
> >>>>>>>On 3/22/06, Stefan Klinger <kl...@cs.york.ac.uk> wrote:
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>>Hello all,
> >>>>>>>>
> >>>>>>>>I am trying to include a file upload facility using http within my
> >>>>>>>>project. Unfortunately, my file is not an xml document, so it should be
> >>>>>>>>treated as an attachment. If I am correct, the HttpMarshaler only
> >>>>>>>>accepts xml documents which are set to the message content. Would there
> >>>>>>>>be a way to accept non-xml files and set them as message attachments
> >>>>>>>>(similar to the SaajMarshaler)? Or is there another, more elegant way of
> >>>>>>>>doing this?
> >>>>>>>>
> >>>>>>>>Thanks,
> >>>>>>>>Stefan
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>
> >>>>>>
> >>>>
> >>>>
> >>
> >>
> >
> >
> >
>
>
Re: FileUpload via Http
Posted by Stefan Klinger <kl...@cs.york.ac.uk>.
Guillaume,
I can see that the multipart/ contents is working fine from http -> jbi.
However, I now would like to convert that message back from jbi ->
http. However, it seems like the HttpClientMarshaler is ignoring the
MIME attachments of the jbi message. Is it possible to add that
functionality as well?
Thanks,
Stefan
Guillaume Nodet wrote:
>On 3/23/06, Stefan Klinger <kl...@cs.york.ac.uk> wrote:
>
>
>>Guillaume,
>>Thanks for the very quick fix of this issue (And sorry for adding the
>>jira again :-[ ). It seems to work fine now.
>>
>>
>
>No problem. As I wanted to commit the fix, I had to create the JIRA ...
>
>
>
>>Just a quick question - the first part needs to be an xml file. My guess
>>is that the reason for doing this is that you convert the mime message
>>to a soap message before converting it into a jbi message, and the soap
>>message requires a xml source. For me personally, it is not always
>>convenient to have the first part (or any part) being an xml document
>>for legacy reasons. But I am sure I will find a workaround for it.
>>
>>
>
>The main reason is that ServiceMix does not work well when no xml content
>is set on the message. This could be improved...
>If you don't use it, just send a dummy xml, like <dummy/>. It will do
>the trick.
>
>Cheers,
>Guillaume Nodet
>
>
>
>>Thanks again for the very quick fix.
>>Stefan
>>
>>
>>Guillaume Nodet wrote:
>>
>>
>>
>>>This should works now. FYI, the first mime part will be used as the
>>>xml payload content, so that you will need to send a valid xml in it
>>>(event some dummy xml).
>>>
>>>Cheers,
>>>Guillaume Nodet
>>>
>>>On 3/22/06, Stefan Klinger <kl...@cs.york.ac.uk> wrote:
>>>
>>>
>>>
>>>
>>>>Thanks for the reply Guillaume.
>>>>
>>>>It would be great (for me) if the other multipart contents were
>>>>supported as part of SM as well.
>>>>
>>>>Thanks again and keep up the good work!
>>>>Stefan
>>>>
>>>>Guillaume Nodet wrote:
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>>Currently, only multipart/related mime type (RFC2387) is supported.
>>>>>Other multipart contents are not supported :(
>>>>>This includes
>>>>>* multipart/mixed (RFC1521)
>>>>>* multipart/formdata (RFC1867)
>>>>>
>>>>>I'm trying to see if it is possible to support them.
>>>>>
>>>>>Cheers,
>>>>>Guillaume Nodet
>>>>>
>>>>>On 3/22/06, Stefan Klinger <kl...@cs.york.ac.uk> wrote:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>Thanks Guillaume,
>>>>>>
>>>>>>I have tried using the HttpComponent, but it threw an exception in the
>>>>>>DeliveryChannel and ReceiverComponent. My client code is the following:
>>>>>>
>>>>>> File f = new File("some_file.txt");
>>>>>> PostMethod filePost = new
>>>>>>PostMethod("http://localhost:8192/Service/");
>>>>>> Part[] parts = { new StringPart("param_name", "value"),
>>>>>> new FilePart(f.getName(), f) };
>>>>>> filePost.setRequestEntity(
>>>>>> new MultipartRequestEntity(parts, filePost.getParams()) );
>>>>>> HttpClient client = new HttpClient();
>>>>>> int status = client.executeMethod(filePost);
>>>>>> filePost.releaseConnection();
>>>>>>
>>>>>>and my XmlBeans configuration file is the following
>>>>>>
>>>>>> <sm:activationSpec>
>>>>>> <sm:component>
>>>>>> <http:component>
>>>>>> <http:endpoints>
>>>>>> <http:endpoint service="test:MyConsumerService"
>>>>>> endpoint="myConsumer"
>>>>>> role="consumer"
>>>>>>
>>>>>>locationURI="http://localhost:8192/Service/"
>>>>>>
>>>>>>defaultMep="http://www.w3.org/2004/08/wsdl/in-only" />
>>>>>> </http:endpoints>
>>>>>> </http:component>
>>>>>> </sm:component>
>>>>>> </sm:activationSpec>
>>>>>>
>>>>>> <sm:activationSpec service="test:MyConsumerService"
>>>>>>endpoint="myConsumer">
>>>>>> <sm:component>
>>>>>> <bean class="org.apache.servicemix.tck.ReceiverComponent" />
>>>>>> </sm:component>
>>>>>> </sm:activationSpec>
>>>>>>
>>>>>>and I get the following exceptions
>>>>>>
>>>>>>[edThreadPool0-1] DEBUG DeliveryChannel - Unable to
>>>>>>display message
>>>>>>org.xml.sax.SAXParseException: Content is not allowed in prolog.
>>>>>> at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
>>>>>> at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
>>>>>> at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:123)
>>>>>> at
>>>>>>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSourceFromStream(SourceTransformer.java:221)
>>>>>> at
>>>>>>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSource(SourceTransformer.java:136)
>>>>>> at
>>>>>>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMNode(SourceTransformer.java:275)
>>>>>> at
>>>>>>org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.traceMessageExchange(DeliveryChannelImpl.java:297)
>>>>>> at
>>>>>>org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(DeliveryChannelImpl.java:388)
>>>>>> at
>>>>>>org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(DeliveryChannelImpl.java:490)
>>>>>> at
>>>>>>org.apache.servicemix.common.BaseLifeCycle.sendConsumerExchange(BaseLifeCycle.java:389)
>>>>>> at
>>>>>>org.apache.servicemix.http.processors.ConsumerProcessor.process(ConsumerProcessor.java:131)
>>>>>> at
>>>>>>org.apache.servicemix.http.HttpBridgeServlet.doPost(HttpBridgeServlet.java:70)
>>>>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:615)
>>>>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
>>>>>>
>>>>>>SEVERE: org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1@1c66ec7 got
>>>>>>error processing org.apache.servicemix.jbi.messaging.InOnlyImpl@92eb86
>>>>>>javax.jbi.messaging.MessagingException: org.xml.sax.SAXParseException:
>>>>>>Content is not allowed in prolog.
>>>>>> at
>>>>>>org.apache.servicemix.components.util.CopyTransformer.transform(CopyTransformer.java:80)
>>>>>> at
>>>>>>org.apache.servicemix.tck.ReceiverComponent.onMessageExchange(ReceiverComponent.java:47)
>>>>>> at
>>>>>>org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:636)
>>>>>> at
>>>>>>org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:171)
>>>>>> at
>>>>>>org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:221)
>>>>>> at
>>>>>>org.apache.geronimo.connector.work.WorkerContext.run(WorkerContext.java:291)
>>>>>> at
>>>>>>EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(Unknown Source)
>>>>>> at java.lang.Thread.run(Thread.java:595)
>>>>>>Caused by: org.xml.sax.SAXParseException: Content is not allowed in prolog.
>>>>>> at
>>>>>>com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:264)
>>>>>> at
>>>>>>com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:292)
>>>>>> at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:123)
>>>>>> at
>>>>>>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSourceFromStream(SourceTransformer.java:221)
>>>>>> at
>>>>>>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSource(SourceTransformer.java:136)
>>>>>> at
>>>>>>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMNode(SourceTransformer.java:275)
>>>>>> at
>>>>>>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMNode(SourceTransformer.java:302)
>>>>>> at
>>>>>>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSource(SourceTransformer.java:144)
>>>>>> at
>>>>>>org.apache.servicemix.components.util.CopyTransformer.transform(CopyTransformer.java:68)
>>>>>> ... 7 more
>>>>>>
>>>>>>Thanks,
>>>>>>Stefan
>>>>>>
>>>>>>Guillaume Nodet wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>>The servicemix-http component handles MIME attachments.
>>>>>>>You should give it a try.
>>>>>>>
>>>>>>>Cheers,
>>>>>>>Guillaume Nodet
>>>>>>>
>>>>>>>On 3/22/06, Stefan Klinger <kl...@cs.york.ac.uk> wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>Hello all,
>>>>>>>>
>>>>>>>>I am trying to include a file upload facility using http within my
>>>>>>>>project. Unfortunately, my file is not an xml document, so it should be
>>>>>>>>treated as an attachment. If I am correct, the HttpMarshaler only
>>>>>>>>accepts xml documents which are set to the message content. Would there
>>>>>>>>be a way to accept non-xml files and set them as message attachments
>>>>>>>>(similar to the SaajMarshaler)? Or is there another, more elegant way of
>>>>>>>>doing this?
>>>>>>>>
>>>>>>>>Thanks,
>>>>>>>>Stefan
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>
>>>>>>
>>>>
>>>>
>>
>>
>
>
>
Re: FileUpload via Http
Posted by Guillaume Nodet <gn...@gmail.com>.
On 3/23/06, Stefan Klinger <kl...@cs.york.ac.uk> wrote:
> Guillaume,
> Thanks for the very quick fix of this issue (And sorry for adding the
> jira again :-[ ). It seems to work fine now.
No problem. As I wanted to commit the fix, I had to create the JIRA ...
>
> Just a quick question - the first part needs to be an xml file. My guess
> is that the reason for doing this is that you convert the mime message
> to a soap message before converting it into a jbi message, and the soap
> message requires a xml source. For me personally, it is not always
> convenient to have the first part (or any part) being an xml document
> for legacy reasons. But I am sure I will find a workaround for it.
The main reason is that ServiceMix does not work well when no xml content
is set on the message. This could be improved...
If you don't use it, just send a dummy xml, like <dummy/>. It will do
the trick.
Cheers,
Guillaume Nodet
>
> Thanks again for the very quick fix.
> Stefan
>
>
> Guillaume Nodet wrote:
>
> >This should works now. FYI, the first mime part will be used as the
> >xml payload content, so that you will need to send a valid xml in it
> >(event some dummy xml).
> >
> >Cheers,
> >Guillaume Nodet
> >
> >On 3/22/06, Stefan Klinger <kl...@cs.york.ac.uk> wrote:
> >
> >
> >>Thanks for the reply Guillaume.
> >>
> >>It would be great (for me) if the other multipart contents were
> >>supported as part of SM as well.
> >>
> >>Thanks again and keep up the good work!
> >>Stefan
> >>
> >>Guillaume Nodet wrote:
> >>
> >>
> >>
> >>>Currently, only multipart/related mime type (RFC2387) is supported.
> >>>Other multipart contents are not supported :(
> >>>This includes
> >>>* multipart/mixed (RFC1521)
> >>>* multipart/formdata (RFC1867)
> >>>
> >>>I'm trying to see if it is possible to support them.
> >>>
> >>>Cheers,
> >>>Guillaume Nodet
> >>>
> >>>On 3/22/06, Stefan Klinger <kl...@cs.york.ac.uk> wrote:
> >>>
> >>>
> >>>
> >>>
> >>>>Thanks Guillaume,
> >>>>
> >>>>I have tried using the HttpComponent, but it threw an exception in the
> >>>>DeliveryChannel and ReceiverComponent. My client code is the following:
> >>>>
> >>>> File f = new File("some_file.txt");
> >>>> PostMethod filePost = new
> >>>>PostMethod("http://localhost:8192/Service/");
> >>>> Part[] parts = { new StringPart("param_name", "value"),
> >>>> new FilePart(f.getName(), f) };
> >>>> filePost.setRequestEntity(
> >>>> new MultipartRequestEntity(parts, filePost.getParams()) );
> >>>> HttpClient client = new HttpClient();
> >>>> int status = client.executeMethod(filePost);
> >>>> filePost.releaseConnection();
> >>>>
> >>>>and my XmlBeans configuration file is the following
> >>>>
> >>>> <sm:activationSpec>
> >>>> <sm:component>
> >>>> <http:component>
> >>>> <http:endpoints>
> >>>> <http:endpoint service="test:MyConsumerService"
> >>>> endpoint="myConsumer"
> >>>> role="consumer"
> >>>>
> >>>>locationURI="http://localhost:8192/Service/"
> >>>>
> >>>>defaultMep="http://www.w3.org/2004/08/wsdl/in-only" />
> >>>> </http:endpoints>
> >>>> </http:component>
> >>>> </sm:component>
> >>>> </sm:activationSpec>
> >>>>
> >>>> <sm:activationSpec service="test:MyConsumerService"
> >>>>endpoint="myConsumer">
> >>>> <sm:component>
> >>>> <bean class="org.apache.servicemix.tck.ReceiverComponent" />
> >>>> </sm:component>
> >>>> </sm:activationSpec>
> >>>>
> >>>>and I get the following exceptions
> >>>>
> >>>>[edThreadPool0-1] DEBUG DeliveryChannel - Unable to
> >>>>display message
> >>>>org.xml.sax.SAXParseException: Content is not allowed in prolog.
> >>>> at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
> >>>> at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
> >>>> at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:123)
> >>>> at
> >>>>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSourceFromStream(SourceTransformer.java:221)
> >>>> at
> >>>>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSource(SourceTransformer.java:136)
> >>>> at
> >>>>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMNode(SourceTransformer.java:275)
> >>>> at
> >>>>org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.traceMessageExchange(DeliveryChannelImpl.java:297)
> >>>> at
> >>>>org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(DeliveryChannelImpl.java:388)
> >>>> at
> >>>>org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(DeliveryChannelImpl.java:490)
> >>>> at
> >>>>org.apache.servicemix.common.BaseLifeCycle.sendConsumerExchange(BaseLifeCycle.java:389)
> >>>> at
> >>>>org.apache.servicemix.http.processors.ConsumerProcessor.process(ConsumerProcessor.java:131)
> >>>> at
> >>>>org.apache.servicemix.http.HttpBridgeServlet.doPost(HttpBridgeServlet.java:70)
> >>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:615)
> >>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
> >>>>
> >>>>SEVERE: org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1@1c66ec7 got
> >>>>error processing org.apache.servicemix.jbi.messaging.InOnlyImpl@92eb86
> >>>>javax.jbi.messaging.MessagingException: org.xml.sax.SAXParseException:
> >>>>Content is not allowed in prolog.
> >>>> at
> >>>>org.apache.servicemix.components.util.CopyTransformer.transform(CopyTransformer.java:80)
> >>>> at
> >>>>org.apache.servicemix.tck.ReceiverComponent.onMessageExchange(ReceiverComponent.java:47)
> >>>> at
> >>>>org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:636)
> >>>> at
> >>>>org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:171)
> >>>> at
> >>>>org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:221)
> >>>> at
> >>>>org.apache.geronimo.connector.work.WorkerContext.run(WorkerContext.java:291)
> >>>> at
> >>>>EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(Unknown Source)
> >>>> at java.lang.Thread.run(Thread.java:595)
> >>>>Caused by: org.xml.sax.SAXParseException: Content is not allowed in prolog.
> >>>> at
> >>>>com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:264)
> >>>> at
> >>>>com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:292)
> >>>> at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:123)
> >>>> at
> >>>>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSourceFromStream(SourceTransformer.java:221)
> >>>> at
> >>>>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSource(SourceTransformer.java:136)
> >>>> at
> >>>>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMNode(SourceTransformer.java:275)
> >>>> at
> >>>>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMNode(SourceTransformer.java:302)
> >>>> at
> >>>>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSource(SourceTransformer.java:144)
> >>>> at
> >>>>org.apache.servicemix.components.util.CopyTransformer.transform(CopyTransformer.java:68)
> >>>> ... 7 more
> >>>>
> >>>>Thanks,
> >>>>Stefan
> >>>>
> >>>>Guillaume Nodet wrote:
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>>The servicemix-http component handles MIME attachments.
> >>>>>You should give it a try.
> >>>>>
> >>>>>Cheers,
> >>>>>Guillaume Nodet
> >>>>>
> >>>>>On 3/22/06, Stefan Klinger <kl...@cs.york.ac.uk> wrote:
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>>Hello all,
> >>>>>>
> >>>>>>I am trying to include a file upload facility using http within my
> >>>>>>project. Unfortunately, my file is not an xml document, so it should be
> >>>>>>treated as an attachment. If I am correct, the HttpMarshaler only
> >>>>>>accepts xml documents which are set to the message content. Would there
> >>>>>>be a way to accept non-xml files and set them as message attachments
> >>>>>>(similar to the SaajMarshaler)? Or is there another, more elegant way of
> >>>>>>doing this?
> >>>>>>
> >>>>>>Thanks,
> >>>>>>Stefan
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>
> >>>>
> >>
> >>
>
>
Re: FileUpload via Http
Posted by Stefan Klinger <kl...@cs.york.ac.uk>.
Guillaume,
Thanks for the very quick fix of this issue (And sorry for adding the
jira again :-[ ). It seems to work fine now.
Just a quick question - the first part needs to be an xml file. My guess
is that the reason for doing this is that you convert the mime message
to a soap message before converting it into a jbi message, and the soap
message requires a xml source. For me personally, it is not always
convenient to have the first part (or any part) being an xml document
for legacy reasons. But I am sure I will find a workaround for it.
Thanks again for the very quick fix.
Stefan
Guillaume Nodet wrote:
>This should works now. FYI, the first mime part will be used as the
>xml payload content, so that you will need to send a valid xml in it
>(event some dummy xml).
>
>Cheers,
>Guillaume Nodet
>
>On 3/22/06, Stefan Klinger <kl...@cs.york.ac.uk> wrote:
>
>
>>Thanks for the reply Guillaume.
>>
>>It would be great (for me) if the other multipart contents were
>>supported as part of SM as well.
>>
>>Thanks again and keep up the good work!
>>Stefan
>>
>>Guillaume Nodet wrote:
>>
>>
>>
>>>Currently, only multipart/related mime type (RFC2387) is supported.
>>>Other multipart contents are not supported :(
>>>This includes
>>>* multipart/mixed (RFC1521)
>>>* multipart/formdata (RFC1867)
>>>
>>>I'm trying to see if it is possible to support them.
>>>
>>>Cheers,
>>>Guillaume Nodet
>>>
>>>On 3/22/06, Stefan Klinger <kl...@cs.york.ac.uk> wrote:
>>>
>>>
>>>
>>>
>>>>Thanks Guillaume,
>>>>
>>>>I have tried using the HttpComponent, but it threw an exception in the
>>>>DeliveryChannel and ReceiverComponent. My client code is the following:
>>>>
>>>> File f = new File("some_file.txt");
>>>> PostMethod filePost = new
>>>>PostMethod("http://localhost:8192/Service/");
>>>> Part[] parts = { new StringPart("param_name", "value"),
>>>> new FilePart(f.getName(), f) };
>>>> filePost.setRequestEntity(
>>>> new MultipartRequestEntity(parts, filePost.getParams()) );
>>>> HttpClient client = new HttpClient();
>>>> int status = client.executeMethod(filePost);
>>>> filePost.releaseConnection();
>>>>
>>>>and my XmlBeans configuration file is the following
>>>>
>>>> <sm:activationSpec>
>>>> <sm:component>
>>>> <http:component>
>>>> <http:endpoints>
>>>> <http:endpoint service="test:MyConsumerService"
>>>> endpoint="myConsumer"
>>>> role="consumer"
>>>>
>>>>locationURI="http://localhost:8192/Service/"
>>>>
>>>>defaultMep="http://www.w3.org/2004/08/wsdl/in-only" />
>>>> </http:endpoints>
>>>> </http:component>
>>>> </sm:component>
>>>> </sm:activationSpec>
>>>>
>>>> <sm:activationSpec service="test:MyConsumerService"
>>>>endpoint="myConsumer">
>>>> <sm:component>
>>>> <bean class="org.apache.servicemix.tck.ReceiverComponent" />
>>>> </sm:component>
>>>> </sm:activationSpec>
>>>>
>>>>and I get the following exceptions
>>>>
>>>>[edThreadPool0-1] DEBUG DeliveryChannel - Unable to
>>>>display message
>>>>org.xml.sax.SAXParseException: Content is not allowed in prolog.
>>>> at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
>>>> at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
>>>> at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:123)
>>>> at
>>>>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSourceFromStream(SourceTransformer.java:221)
>>>> at
>>>>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSource(SourceTransformer.java:136)
>>>> at
>>>>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMNode(SourceTransformer.java:275)
>>>> at
>>>>org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.traceMessageExchange(DeliveryChannelImpl.java:297)
>>>> at
>>>>org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(DeliveryChannelImpl.java:388)
>>>> at
>>>>org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(DeliveryChannelImpl.java:490)
>>>> at
>>>>org.apache.servicemix.common.BaseLifeCycle.sendConsumerExchange(BaseLifeCycle.java:389)
>>>> at
>>>>org.apache.servicemix.http.processors.ConsumerProcessor.process(ConsumerProcessor.java:131)
>>>> at
>>>>org.apache.servicemix.http.HttpBridgeServlet.doPost(HttpBridgeServlet.java:70)
>>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:615)
>>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
>>>>
>>>>SEVERE: org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1@1c66ec7 got
>>>>error processing org.apache.servicemix.jbi.messaging.InOnlyImpl@92eb86
>>>>javax.jbi.messaging.MessagingException: org.xml.sax.SAXParseException:
>>>>Content is not allowed in prolog.
>>>> at
>>>>org.apache.servicemix.components.util.CopyTransformer.transform(CopyTransformer.java:80)
>>>> at
>>>>org.apache.servicemix.tck.ReceiverComponent.onMessageExchange(ReceiverComponent.java:47)
>>>> at
>>>>org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:636)
>>>> at
>>>>org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:171)
>>>> at
>>>>org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:221)
>>>> at
>>>>org.apache.geronimo.connector.work.WorkerContext.run(WorkerContext.java:291)
>>>> at
>>>>EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(Unknown Source)
>>>> at java.lang.Thread.run(Thread.java:595)
>>>>Caused by: org.xml.sax.SAXParseException: Content is not allowed in prolog.
>>>> at
>>>>com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:264)
>>>> at
>>>>com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:292)
>>>> at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:123)
>>>> at
>>>>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSourceFromStream(SourceTransformer.java:221)
>>>> at
>>>>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSource(SourceTransformer.java:136)
>>>> at
>>>>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMNode(SourceTransformer.java:275)
>>>> at
>>>>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMNode(SourceTransformer.java:302)
>>>> at
>>>>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSource(SourceTransformer.java:144)
>>>> at
>>>>org.apache.servicemix.components.util.CopyTransformer.transform(CopyTransformer.java:68)
>>>> ... 7 more
>>>>
>>>>Thanks,
>>>>Stefan
>>>>
>>>>Guillaume Nodet wrote:
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>>The servicemix-http component handles MIME attachments.
>>>>>You should give it a try.
>>>>>
>>>>>Cheers,
>>>>>Guillaume Nodet
>>>>>
>>>>>On 3/22/06, Stefan Klinger <kl...@cs.york.ac.uk> wrote:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>Hello all,
>>>>>>
>>>>>>I am trying to include a file upload facility using http within my
>>>>>>project. Unfortunately, my file is not an xml document, so it should be
>>>>>>treated as an attachment. If I am correct, the HttpMarshaler only
>>>>>>accepts xml documents which are set to the message content. Would there
>>>>>>be a way to accept non-xml files and set them as message attachments
>>>>>>(similar to the SaajMarshaler)? Or is there another, more elegant way of
>>>>>>doing this?
>>>>>>
>>>>>>Thanks,
>>>>>>Stefan
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>
>>>>
>>
>>
Re: FileUpload via Http
Posted by Guillaume Nodet <gn...@gmail.com>.
This should works now. FYI, the first mime part will be used as the
xml payload content, so that you will need to send a valid xml in it
(event some dummy xml).
Cheers,
Guillaume Nodet
On 3/22/06, Stefan Klinger <kl...@cs.york.ac.uk> wrote:
> Thanks for the reply Guillaume.
>
> It would be great (for me) if the other multipart contents were
> supported as part of SM as well.
>
> Thanks again and keep up the good work!
> Stefan
>
> Guillaume Nodet wrote:
>
> >Currently, only multipart/related mime type (RFC2387) is supported.
> >Other multipart contents are not supported :(
> >This includes
> > * multipart/mixed (RFC1521)
> > * multipart/formdata (RFC1867)
> >
> >I'm trying to see if it is possible to support them.
> >
> >Cheers,
> >Guillaume Nodet
> >
> >On 3/22/06, Stefan Klinger <kl...@cs.york.ac.uk> wrote:
> >
> >
> >>Thanks Guillaume,
> >>
> >>I have tried using the HttpComponent, but it threw an exception in the
> >>DeliveryChannel and ReceiverComponent. My client code is the following:
> >>
> >> File f = new File("some_file.txt");
> >> PostMethod filePost = new
> >>PostMethod("http://localhost:8192/Service/");
> >> Part[] parts = { new StringPart("param_name", "value"),
> >> new FilePart(f.getName(), f) };
> >> filePost.setRequestEntity(
> >> new MultipartRequestEntity(parts, filePost.getParams()) );
> >> HttpClient client = new HttpClient();
> >> int status = client.executeMethod(filePost);
> >> filePost.releaseConnection();
> >>
> >>and my XmlBeans configuration file is the following
> >>
> >> <sm:activationSpec>
> >> <sm:component>
> >> <http:component>
> >> <http:endpoints>
> >> <http:endpoint service="test:MyConsumerService"
> >> endpoint="myConsumer"
> >> role="consumer"
> >>
> >>locationURI="http://localhost:8192/Service/"
> >>
> >>defaultMep="http://www.w3.org/2004/08/wsdl/in-only" />
> >> </http:endpoints>
> >> </http:component>
> >> </sm:component>
> >> </sm:activationSpec>
> >>
> >> <sm:activationSpec service="test:MyConsumerService"
> >>endpoint="myConsumer">
> >> <sm:component>
> >> <bean class="org.apache.servicemix.tck.ReceiverComponent" />
> >> </sm:component>
> >> </sm:activationSpec>
> >>
> >>and I get the following exceptions
> >>
> >>[edThreadPool0-1] DEBUG DeliveryChannel - Unable to
> >>display message
> >>org.xml.sax.SAXParseException: Content is not allowed in prolog.
> >> at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
> >> at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
> >> at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:123)
> >> at
> >>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSourceFromStream(SourceTransformer.java:221)
> >> at
> >>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSource(SourceTransformer.java:136)
> >> at
> >>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMNode(SourceTransformer.java:275)
> >> at
> >>org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.traceMessageExchange(DeliveryChannelImpl.java:297)
> >> at
> >>org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(DeliveryChannelImpl.java:388)
> >> at
> >>org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(DeliveryChannelImpl.java:490)
> >> at
> >>org.apache.servicemix.common.BaseLifeCycle.sendConsumerExchange(BaseLifeCycle.java:389)
> >> at
> >>org.apache.servicemix.http.processors.ConsumerProcessor.process(ConsumerProcessor.java:131)
> >> at
> >>org.apache.servicemix.http.HttpBridgeServlet.doPost(HttpBridgeServlet.java:70)
> >> at javax.servlet.http.HttpServlet.service(HttpServlet.java:615)
> >> at javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
> >>
> >>SEVERE: org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1@1c66ec7 got
> >>error processing org.apache.servicemix.jbi.messaging.InOnlyImpl@92eb86
> >>javax.jbi.messaging.MessagingException: org.xml.sax.SAXParseException:
> >>Content is not allowed in prolog.
> >> at
> >>org.apache.servicemix.components.util.CopyTransformer.transform(CopyTransformer.java:80)
> >> at
> >>org.apache.servicemix.tck.ReceiverComponent.onMessageExchange(ReceiverComponent.java:47)
> >> at
> >>org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:636)
> >> at
> >>org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:171)
> >> at
> >>org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:221)
> >> at
> >>org.apache.geronimo.connector.work.WorkerContext.run(WorkerContext.java:291)
> >> at
> >>EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(Unknown Source)
> >> at java.lang.Thread.run(Thread.java:595)
> >>Caused by: org.xml.sax.SAXParseException: Content is not allowed in prolog.
> >> at
> >>com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:264)
> >> at
> >>com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:292)
> >> at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:123)
> >> at
> >>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSourceFromStream(SourceTransformer.java:221)
> >> at
> >>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSource(SourceTransformer.java:136)
> >> at
> >>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMNode(SourceTransformer.java:275)
> >> at
> >>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMNode(SourceTransformer.java:302)
> >> at
> >>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSource(SourceTransformer.java:144)
> >> at
> >>org.apache.servicemix.components.util.CopyTransformer.transform(CopyTransformer.java:68)
> >> ... 7 more
> >>
> >>Thanks,
> >>Stefan
> >>
> >>Guillaume Nodet wrote:
> >>
> >>
> >>
> >>>The servicemix-http component handles MIME attachments.
> >>>You should give it a try.
> >>>
> >>>Cheers,
> >>>Guillaume Nodet
> >>>
> >>>On 3/22/06, Stefan Klinger <kl...@cs.york.ac.uk> wrote:
> >>>
> >>>
> >>>
> >>>
> >>>>Hello all,
> >>>>
> >>>>I am trying to include a file upload facility using http within my
> >>>>project. Unfortunately, my file is not an xml document, so it should be
> >>>>treated as an attachment. If I am correct, the HttpMarshaler only
> >>>>accepts xml documents which are set to the message content. Would there
> >>>>be a way to accept non-xml files and set them as message attachments
> >>>>(similar to the SaajMarshaler)? Or is there another, more elegant way of
> >>>>doing this?
> >>>>
> >>>>Thanks,
> >>>>Stefan
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>
> >>
>
>
Re: FileUpload via Http
Posted by Guillaume Nodet <gn...@gmail.com>.
Could you please raise a JIRA for that ?
Thanks,
Guillaume Nodet
On 3/22/06, Stefan Klinger <kl...@cs.york.ac.uk> wrote:
> Thanks for the reply Guillaume.
>
> It would be great (for me) if the other multipart contents were
> supported as part of SM as well.
>
> Thanks again and keep up the good work!
> Stefan
>
> Guillaume Nodet wrote:
>
> >Currently, only multipart/related mime type (RFC2387) is supported.
> >Other multipart contents are not supported :(
> >This includes
> > * multipart/mixed (RFC1521)
> > * multipart/formdata (RFC1867)
> >
> >I'm trying to see if it is possible to support them.
> >
> >Cheers,
> >Guillaume Nodet
> >
> >On 3/22/06, Stefan Klinger <kl...@cs.york.ac.uk> wrote:
> >
> >
> >>Thanks Guillaume,
> >>
> >>I have tried using the HttpComponent, but it threw an exception in the
> >>DeliveryChannel and ReceiverComponent. My client code is the following:
> >>
> >> File f = new File("some_file.txt");
> >> PostMethod filePost = new
> >>PostMethod("http://localhost:8192/Service/");
> >> Part[] parts = { new StringPart("param_name", "value"),
> >> new FilePart(f.getName(), f) };
> >> filePost.setRequestEntity(
> >> new MultipartRequestEntity(parts, filePost.getParams()) );
> >> HttpClient client = new HttpClient();
> >> int status = client.executeMethod(filePost);
> >> filePost.releaseConnection();
> >>
> >>and my XmlBeans configuration file is the following
> >>
> >> <sm:activationSpec>
> >> <sm:component>
> >> <http:component>
> >> <http:endpoints>
> >> <http:endpoint service="test:MyConsumerService"
> >> endpoint="myConsumer"
> >> role="consumer"
> >>
> >>locationURI="http://localhost:8192/Service/"
> >>
> >>defaultMep="http://www.w3.org/2004/08/wsdl/in-only" />
> >> </http:endpoints>
> >> </http:component>
> >> </sm:component>
> >> </sm:activationSpec>
> >>
> >> <sm:activationSpec service="test:MyConsumerService"
> >>endpoint="myConsumer">
> >> <sm:component>
> >> <bean class="org.apache.servicemix.tck.ReceiverComponent" />
> >> </sm:component>
> >> </sm:activationSpec>
> >>
> >>and I get the following exceptions
> >>
> >>[edThreadPool0-1] DEBUG DeliveryChannel - Unable to
> >>display message
> >>org.xml.sax.SAXParseException: Content is not allowed in prolog.
> >> at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
> >> at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
> >> at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:123)
> >> at
> >>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSourceFromStream(SourceTransformer.java:221)
> >> at
> >>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSource(SourceTransformer.java:136)
> >> at
> >>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMNode(SourceTransformer.java:275)
> >> at
> >>org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.traceMessageExchange(DeliveryChannelImpl.java:297)
> >> at
> >>org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(DeliveryChannelImpl.java:388)
> >> at
> >>org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(DeliveryChannelImpl.java:490)
> >> at
> >>org.apache.servicemix.common.BaseLifeCycle.sendConsumerExchange(BaseLifeCycle.java:389)
> >> at
> >>org.apache.servicemix.http.processors.ConsumerProcessor.process(ConsumerProcessor.java:131)
> >> at
> >>org.apache.servicemix.http.HttpBridgeServlet.doPost(HttpBridgeServlet.java:70)
> >> at javax.servlet.http.HttpServlet.service(HttpServlet.java:615)
> >> at javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
> >>
> >>SEVERE: org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1@1c66ec7 got
> >>error processing org.apache.servicemix.jbi.messaging.InOnlyImpl@92eb86
> >>javax.jbi.messaging.MessagingException: org.xml.sax.SAXParseException:
> >>Content is not allowed in prolog.
> >> at
> >>org.apache.servicemix.components.util.CopyTransformer.transform(CopyTransformer.java:80)
> >> at
> >>org.apache.servicemix.tck.ReceiverComponent.onMessageExchange(ReceiverComponent.java:47)
> >> at
> >>org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:636)
> >> at
> >>org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:171)
> >> at
> >>org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:221)
> >> at
> >>org.apache.geronimo.connector.work.WorkerContext.run(WorkerContext.java:291)
> >> at
> >>EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(Unknown Source)
> >> at java.lang.Thread.run(Thread.java:595)
> >>Caused by: org.xml.sax.SAXParseException: Content is not allowed in prolog.
> >> at
> >>com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:264)
> >> at
> >>com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:292)
> >> at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:123)
> >> at
> >>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSourceFromStream(SourceTransformer.java:221)
> >> at
> >>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSource(SourceTransformer.java:136)
> >> at
> >>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMNode(SourceTransformer.java:275)
> >> at
> >>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMNode(SourceTransformer.java:302)
> >> at
> >>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSource(SourceTransformer.java:144)
> >> at
> >>org.apache.servicemix.components.util.CopyTransformer.transform(CopyTransformer.java:68)
> >> ... 7 more
> >>
> >>Thanks,
> >>Stefan
> >>
> >>Guillaume Nodet wrote:
> >>
> >>
> >>
> >>>The servicemix-http component handles MIME attachments.
> >>>You should give it a try.
> >>>
> >>>Cheers,
> >>>Guillaume Nodet
> >>>
> >>>On 3/22/06, Stefan Klinger <kl...@cs.york.ac.uk> wrote:
> >>>
> >>>
> >>>
> >>>
> >>>>Hello all,
> >>>>
> >>>>I am trying to include a file upload facility using http within my
> >>>>project. Unfortunately, my file is not an xml document, so it should be
> >>>>treated as an attachment. If I am correct, the HttpMarshaler only
> >>>>accepts xml documents which are set to the message content. Would there
> >>>>be a way to accept non-xml files and set them as message attachments
> >>>>(similar to the SaajMarshaler)? Or is there another, more elegant way of
> >>>>doing this?
> >>>>
> >>>>Thanks,
> >>>>Stefan
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>
> >>
>
>
Re: FileUpload via Http
Posted by Stefan Klinger <kl...@cs.york.ac.uk>.
Thanks for the reply Guillaume.
It would be great (for me) if the other multipart contents were
supported as part of SM as well.
Thanks again and keep up the good work!
Stefan
Guillaume Nodet wrote:
>Currently, only multipart/related mime type (RFC2387) is supported.
>Other multipart contents are not supported :(
>This includes
> * multipart/mixed (RFC1521)
> * multipart/formdata (RFC1867)
>
>I'm trying to see if it is possible to support them.
>
>Cheers,
>Guillaume Nodet
>
>On 3/22/06, Stefan Klinger <kl...@cs.york.ac.uk> wrote:
>
>
>>Thanks Guillaume,
>>
>>I have tried using the HttpComponent, but it threw an exception in the
>>DeliveryChannel and ReceiverComponent. My client code is the following:
>>
>> File f = new File("some_file.txt");
>> PostMethod filePost = new
>>PostMethod("http://localhost:8192/Service/");
>> Part[] parts = { new StringPart("param_name", "value"),
>> new FilePart(f.getName(), f) };
>> filePost.setRequestEntity(
>> new MultipartRequestEntity(parts, filePost.getParams()) );
>> HttpClient client = new HttpClient();
>> int status = client.executeMethod(filePost);
>> filePost.releaseConnection();
>>
>>and my XmlBeans configuration file is the following
>>
>> <sm:activationSpec>
>> <sm:component>
>> <http:component>
>> <http:endpoints>
>> <http:endpoint service="test:MyConsumerService"
>> endpoint="myConsumer"
>> role="consumer"
>>
>>locationURI="http://localhost:8192/Service/"
>>
>>defaultMep="http://www.w3.org/2004/08/wsdl/in-only" />
>> </http:endpoints>
>> </http:component>
>> </sm:component>
>> </sm:activationSpec>
>>
>> <sm:activationSpec service="test:MyConsumerService"
>>endpoint="myConsumer">
>> <sm:component>
>> <bean class="org.apache.servicemix.tck.ReceiverComponent" />
>> </sm:component>
>> </sm:activationSpec>
>>
>>and I get the following exceptions
>>
>>[edThreadPool0-1] DEBUG DeliveryChannel - Unable to
>>display message
>>org.xml.sax.SAXParseException: Content is not allowed in prolog.
>> at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
>> at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
>> at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:123)
>> at
>>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSourceFromStream(SourceTransformer.java:221)
>> at
>>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSource(SourceTransformer.java:136)
>> at
>>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMNode(SourceTransformer.java:275)
>> at
>>org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.traceMessageExchange(DeliveryChannelImpl.java:297)
>> at
>>org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(DeliveryChannelImpl.java:388)
>> at
>>org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(DeliveryChannelImpl.java:490)
>> at
>>org.apache.servicemix.common.BaseLifeCycle.sendConsumerExchange(BaseLifeCycle.java:389)
>> at
>>org.apache.servicemix.http.processors.ConsumerProcessor.process(ConsumerProcessor.java:131)
>> at
>>org.apache.servicemix.http.HttpBridgeServlet.doPost(HttpBridgeServlet.java:70)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:615)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
>>
>>SEVERE: org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1@1c66ec7 got
>>error processing org.apache.servicemix.jbi.messaging.InOnlyImpl@92eb86
>>javax.jbi.messaging.MessagingException: org.xml.sax.SAXParseException:
>>Content is not allowed in prolog.
>> at
>>org.apache.servicemix.components.util.CopyTransformer.transform(CopyTransformer.java:80)
>> at
>>org.apache.servicemix.tck.ReceiverComponent.onMessageExchange(ReceiverComponent.java:47)
>> at
>>org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:636)
>> at
>>org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:171)
>> at
>>org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:221)
>> at
>>org.apache.geronimo.connector.work.WorkerContext.run(WorkerContext.java:291)
>> at
>>EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(Unknown Source)
>> at java.lang.Thread.run(Thread.java:595)
>>Caused by: org.xml.sax.SAXParseException: Content is not allowed in prolog.
>> at
>>com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:264)
>> at
>>com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:292)
>> at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:123)
>> at
>>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSourceFromStream(SourceTransformer.java:221)
>> at
>>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSource(SourceTransformer.java:136)
>> at
>>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMNode(SourceTransformer.java:275)
>> at
>>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMNode(SourceTransformer.java:302)
>> at
>>org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSource(SourceTransformer.java:144)
>> at
>>org.apache.servicemix.components.util.CopyTransformer.transform(CopyTransformer.java:68)
>> ... 7 more
>>
>>Thanks,
>>Stefan
>>
>>Guillaume Nodet wrote:
>>
>>
>>
>>>The servicemix-http component handles MIME attachments.
>>>You should give it a try.
>>>
>>>Cheers,
>>>Guillaume Nodet
>>>
>>>On 3/22/06, Stefan Klinger <kl...@cs.york.ac.uk> wrote:
>>>
>>>
>>>
>>>
>>>>Hello all,
>>>>
>>>>I am trying to include a file upload facility using http within my
>>>>project. Unfortunately, my file is not an xml document, so it should be
>>>>treated as an attachment. If I am correct, the HttpMarshaler only
>>>>accepts xml documents which are set to the message content. Would there
>>>>be a way to accept non-xml files and set them as message attachments
>>>>(similar to the SaajMarshaler)? Or is there another, more elegant way of
>>>>doing this?
>>>>
>>>>Thanks,
>>>>Stefan
>>>>
>>>>
>>>>
>>>>
>>>>
>>
>>
Re: FileUpload via Http
Posted by Guillaume Nodet <gn...@gmail.com>.
Currently, only multipart/related mime type (RFC2387) is supported.
Other multipart contents are not supported :(
This includes
* multipart/mixed (RFC1521)
* multipart/formdata (RFC1867)
I'm trying to see if it is possible to support them.
Cheers,
Guillaume Nodet
On 3/22/06, Stefan Klinger <kl...@cs.york.ac.uk> wrote:
> Thanks Guillaume,
>
> I have tried using the HttpComponent, but it threw an exception in the
> DeliveryChannel and ReceiverComponent. My client code is the following:
>
> File f = new File("some_file.txt");
> PostMethod filePost = new
> PostMethod("http://localhost:8192/Service/");
> Part[] parts = { new StringPart("param_name", "value"),
> new FilePart(f.getName(), f) };
> filePost.setRequestEntity(
> new MultipartRequestEntity(parts, filePost.getParams()) );
> HttpClient client = new HttpClient();
> int status = client.executeMethod(filePost);
> filePost.releaseConnection();
>
> and my XmlBeans configuration file is the following
>
> <sm:activationSpec>
> <sm:component>
> <http:component>
> <http:endpoints>
> <http:endpoint service="test:MyConsumerService"
> endpoint="myConsumer"
> role="consumer"
>
> locationURI="http://localhost:8192/Service/"
>
> defaultMep="http://www.w3.org/2004/08/wsdl/in-only" />
> </http:endpoints>
> </http:component>
> </sm:component>
> </sm:activationSpec>
>
> <sm:activationSpec service="test:MyConsumerService"
> endpoint="myConsumer">
> <sm:component>
> <bean class="org.apache.servicemix.tck.ReceiverComponent" />
> </sm:component>
> </sm:activationSpec>
>
> and I get the following exceptions
>
> [edThreadPool0-1] DEBUG DeliveryChannel - Unable to
> display message
> org.xml.sax.SAXParseException: Content is not allowed in prolog.
> at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
> at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
> at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:123)
> at
> org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSourceFromStream(SourceTransformer.java:221)
> at
> org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSource(SourceTransformer.java:136)
> at
> org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMNode(SourceTransformer.java:275)
> at
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.traceMessageExchange(DeliveryChannelImpl.java:297)
> at
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(DeliveryChannelImpl.java:388)
> at
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(DeliveryChannelImpl.java:490)
> at
> org.apache.servicemix.common.BaseLifeCycle.sendConsumerExchange(BaseLifeCycle.java:389)
> at
> org.apache.servicemix.http.processors.ConsumerProcessor.process(ConsumerProcessor.java:131)
> at
> org.apache.servicemix.http.HttpBridgeServlet.doPost(HttpBridgeServlet.java:70)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:615)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
>
> SEVERE: org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1@1c66ec7 got
> error processing org.apache.servicemix.jbi.messaging.InOnlyImpl@92eb86
> javax.jbi.messaging.MessagingException: org.xml.sax.SAXParseException:
> Content is not allowed in prolog.
> at
> org.apache.servicemix.components.util.CopyTransformer.transform(CopyTransformer.java:80)
> at
> org.apache.servicemix.tck.ReceiverComponent.onMessageExchange(ReceiverComponent.java:47)
> at
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:636)
> at
> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:171)
> at
> org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:221)
> at
> org.apache.geronimo.connector.work.WorkerContext.run(WorkerContext.java:291)
> at
> EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(Unknown Source)
> at java.lang.Thread.run(Thread.java:595)
> Caused by: org.xml.sax.SAXParseException: Content is not allowed in prolog.
> at
> com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:264)
> at
> com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:292)
> at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:123)
> at
> org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSourceFromStream(SourceTransformer.java:221)
> at
> org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSource(SourceTransformer.java:136)
> at
> org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMNode(SourceTransformer.java:275)
> at
> org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMNode(SourceTransformer.java:302)
> at
> org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSource(SourceTransformer.java:144)
> at
> org.apache.servicemix.components.util.CopyTransformer.transform(CopyTransformer.java:68)
> ... 7 more
>
> Thanks,
> Stefan
>
> Guillaume Nodet wrote:
>
> >The servicemix-http component handles MIME attachments.
> >You should give it a try.
> >
> >Cheers,
> >Guillaume Nodet
> >
> >On 3/22/06, Stefan Klinger <kl...@cs.york.ac.uk> wrote:
> >
> >
> >>Hello all,
> >>
> >>I am trying to include a file upload facility using http within my
> >>project. Unfortunately, my file is not an xml document, so it should be
> >>treated as an attachment. If I am correct, the HttpMarshaler only
> >>accepts xml documents which are set to the message content. Would there
> >>be a way to accept non-xml files and set them as message attachments
> >>(similar to the SaajMarshaler)? Or is there another, more elegant way of
> >>doing this?
> >>
> >>Thanks,
> >>Stefan
> >>
> >>
> >>
>
>
Re: FileUpload via Http
Posted by Stefan Klinger <kl...@cs.york.ac.uk>.
Thanks Guillaume,
I have tried using the HttpComponent, but it threw an exception in the
DeliveryChannel and ReceiverComponent. My client code is the following:
File f = new File("some_file.txt");
PostMethod filePost = new
PostMethod("http://localhost:8192/Service/");
Part[] parts = { new StringPart("param_name", "value"),
new FilePart(f.getName(), f) };
filePost.setRequestEntity(
new MultipartRequestEntity(parts, filePost.getParams()) );
HttpClient client = new HttpClient();
int status = client.executeMethod(filePost);
filePost.releaseConnection();
and my XmlBeans configuration file is the following
<sm:activationSpec>
<sm:component>
<http:component>
<http:endpoints>
<http:endpoint service="test:MyConsumerService"
endpoint="myConsumer"
role="consumer"
locationURI="http://localhost:8192/Service/"
defaultMep="http://www.w3.org/2004/08/wsdl/in-only" />
</http:endpoints>
</http:component>
</sm:component>
</sm:activationSpec>
<sm:activationSpec service="test:MyConsumerService"
endpoint="myConsumer">
<sm:component>
<bean class="org.apache.servicemix.tck.ReceiverComponent" />
</sm:component>
</sm:activationSpec>
and I get the following exceptions
[edThreadPool0-1] DEBUG DeliveryChannel - Unable to
display message
org.xml.sax.SAXParseException: Content is not allowed in prolog.
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:123)
at
org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSourceFromStream(SourceTransformer.java:221)
at
org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSource(SourceTransformer.java:136)
at
org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMNode(SourceTransformer.java:275)
at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.traceMessageExchange(DeliveryChannelImpl.java:297)
at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(DeliveryChannelImpl.java:388)
at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(DeliveryChannelImpl.java:490)
at
org.apache.servicemix.common.BaseLifeCycle.sendConsumerExchange(BaseLifeCycle.java:389)
at
org.apache.servicemix.http.processors.ConsumerProcessor.process(ConsumerProcessor.java:131)
at
org.apache.servicemix.http.HttpBridgeServlet.doPost(HttpBridgeServlet.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:615)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
SEVERE: org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1@1c66ec7 got
error processing org.apache.servicemix.jbi.messaging.InOnlyImpl@92eb86
javax.jbi.messaging.MessagingException: org.xml.sax.SAXParseException:
Content is not allowed in prolog.
at
org.apache.servicemix.components.util.CopyTransformer.transform(CopyTransformer.java:80)
at
org.apache.servicemix.tck.ReceiverComponent.onMessageExchange(ReceiverComponent.java:47)
at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:636)
at
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:171)
at
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:221)
at
org.apache.geronimo.connector.work.WorkerContext.run(WorkerContext.java:291)
at
EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Thread.java:595)
Caused by: org.xml.sax.SAXParseException: Content is not allowed in prolog.
at
com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:264)
at
com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:292)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:123)
at
org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSourceFromStream(SourceTransformer.java:221)
at
org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSource(SourceTransformer.java:136)
at
org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMNode(SourceTransformer.java:275)
at
org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMNode(SourceTransformer.java:302)
at
org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSource(SourceTransformer.java:144)
at
org.apache.servicemix.components.util.CopyTransformer.transform(CopyTransformer.java:68)
... 7 more
Thanks,
Stefan
Guillaume Nodet wrote:
>The servicemix-http component handles MIME attachments.
>You should give it a try.
>
>Cheers,
>Guillaume Nodet
>
>On 3/22/06, Stefan Klinger <kl...@cs.york.ac.uk> wrote:
>
>
>>Hello all,
>>
>>I am trying to include a file upload facility using http within my
>>project. Unfortunately, my file is not an xml document, so it should be
>>treated as an attachment. If I am correct, the HttpMarshaler only
>>accepts xml documents which are set to the message content. Would there
>>be a way to accept non-xml files and set them as message attachments
>>(similar to the SaajMarshaler)? Or is there another, more elegant way of
>>doing this?
>>
>>Thanks,
>>Stefan
>>
>>
>>
Re: FileUpload via Http
Posted by Guillaume Nodet <gn...@gmail.com>.
The servicemix-http component handles MIME attachments.
You should give it a try.
Cheers,
Guillaume Nodet
On 3/22/06, Stefan Klinger <kl...@cs.york.ac.uk> wrote:
> Hello all,
>
> I am trying to include a file upload facility using http within my
> project. Unfortunately, my file is not an xml document, so it should be
> treated as an attachment. If I am correct, the HttpMarshaler only
> accepts xml documents which are set to the message content. Would there
> be a way to accept non-xml files and set them as message attachments
> (similar to the SaajMarshaler)? Or is there another, more elegant way of
> doing this?
>
> Thanks,
> Stefan
>