Re: Error while uploading File using DataHandler
Indeed. Since SwA uses MIME, the content type is sent over the wire in a well defined way and Axis2/Axiom should be able to preserve it. Not sure though for the (file) name. MTOM also uses MIME and a content type is sent over the wire, but since MTOM is defined as an alternative representation of an XML message containing elements of type base64binary, one should not rely on this. Andreas On Thu, Jun 25, 2009 at 11:05, Chinmoy Chakraborty wrote: > Andreas, > > I noticed the content-type info is preserved for SwA but MTOM does not > preserve the info you mentioned. I guess the file can be sent as an > attachment? Whats your opinion on this? > > Chinmoy > > > On Thu, Jun 25, 2009 at 2:28 PM, Chinmoy Chakraborty > wrote: >> >> Could you share your code-snippet? >> >> Chinmoy >> >> >> On Thu, Jun 25, 2009 at 12:45 PM, Moritz Maedler >> wrote: >>> >>> Good morning, >>> >>> the Problem is, that i need to get the content-type from the >>> DataHandler-Object, as >>> the method should be an image-upload that should support various >>> image-types >>> like gif, png, jpeg >>> and so on. >>> The next idea I have, is rerender the image on the server to jpeg using >>> ImageMagicks "convert" and >>> delete the source image afterwards. But I think it must be possible to >>> get >>> the content-type or at least >>> the original filename from the DataHandler-Object. >>> >>> Maybe you can tell me, how to get the ByteArrayDataSource out of the >>> DataHander-Object? >>> >>> Thanks a lot! >>> >>> >> > >
Re: Error while uploading File using DataHandler
Andreas, I noticed the content-type info is preserved for SwA but MTOM does not preserve the info you mentioned. I guess the file can be sent as an attachment? Whats your opinion on this? Chinmoy On Thu, Jun 25, 2009 at 2:28 PM, Chinmoy Chakraborty wrote: > Could you share your code-snippet? > > Chinmoy > > > > On Thu, Jun 25, 2009 at 12:45 PM, Moritz Maedler > wrote: > >> Good morning, >> >> the Problem is, that i need to get the content-type from the >> DataHandler-Object, as >> the method should be an image-upload that should support various >> image-types >> like gif, png, jpeg >> and so on. >> The next idea I have, is rerender the image on the server to jpeg using >> ImageMagicks "convert" and >> delete the source image afterwards. But I think it must be possible to get >> the content-type or at least >> the original filename from the DataHandler-Object. >> >> Maybe you can tell me, how to get the ByteArrayDataSource out of the >> DataHander-Object? >> >> Thanks a lot! >> >> >> >
Re: Error while uploading File using DataHandler
Hello! i posted the code snippet in my first post. If this isn't enough, pls tell me which part you need. Greetings!
Re: Error while uploading File using DataHandler
Could you share your code-snippet? Chinmoy On Thu, Jun 25, 2009 at 12:45 PM, Moritz Maedler wrote: > Good morning, > > the Problem is, that i need to get the content-type from the > DataHandler-Object, as > the method should be an image-upload that should support various > image-types > like gif, png, jpeg > and so on. > The next idea I have, is rerender the image on the server to jpeg using > ImageMagicks "convert" and > delete the source image afterwards. But I think it must be possible to get > the content-type or at least > the original filename from the DataHandler-Object. > > Maybe you can tell me, how to get the ByteArrayDataSource out of the > DataHander-Object? > > Thanks a lot! > > >
Re: Error while uploading File using DataHandler
Please note that Axis2 (as well as other Web service frameworks) use the DataHandler class as a convenient way of representing data of type base64binary. DataHandler is an existing class from the Java Activation Framework and indeed has properties for content type and (file) name. However, this information is not sent as part of the SOAP message and will be lost. You should do the following: - If you use contract first, you may use the XMIME schema [1], which extends the base64binary type to include content type information. - If you use code first, simply add an explicit argument for the content type to your service. Andreas [1] http://www.w3.org/2005/05/xmlmime On Thu, Jun 25, 2009 at 09:15, Moritz Maedler wrote: > Good morning, > > the Problem is, that i need to get the content-type from the > DataHandler-Object, as > the method should be an image-upload that should support various image-types > like gif, png, jpeg > and so on. > The next idea I have, is rerender the image on the server to jpeg using > ImageMagicks "convert" and > delete the source image afterwards. But I think it must be possible to get > the content-type or at least > the original filename from the DataHandler-Object. > > Maybe you can tell me, how to get the ByteArrayDataSource out of the > DataHander-Object? > > Thanks a lot! > > >
AW: Error while uploading File using DataHandler
Good morning, the Problem is, that i need to get the content-type from the DataHandler-Object, as the method should be an image-upload that should support various image-types like gif, png, jpeg and so on. The next idea I have, is rerender the image on the server to jpeg using ImageMagicks "convert" and delete the source image afterwards. But I think it must be possible to get the content-type or at least the original filename from the DataHandler-Object. Maybe you can tell me, how to get the ByteArrayDataSource out of the DataHander-Object? Thanks a lot!
Re: Error while uploading File using DataHandler
You can try setting the content-type in the service class and getting the same in the client side using SwA. Enabling MTOM and SwA means MTOM is getting preference over SwA. Chinmoy On Wed, Jun 24, 2009 at 11:18 PM, Moritz Mädler wrote: > Ok, i found the bug: just forgot to set one argument - damn me. > > I've got another question: As you can see, i request the filetye from the > DataHandler.getName() using String.substring(String.lastindexof(".")). > When i test the POJO-Class locally, i get the correct extension. When i use > it as the mentioned serviceclass i get a "ByteArrayDataSource" > as file-extension, which is completely useless. > > How do i extract the correct file-extension out of my DataHandler? > > Thanks alot! > >
Re: Error while uploading File using DataHandler
Ok, i found the bug: just forgot to set one argument - damn me. I've got another question: As you can see, i request the filetye from the DataHandler.getName() using String.substring(String.lastindexof(".")). When i test the POJO-Class locally, i get the correct extension. When i use it as the mentioned serviceclass i get a "ByteArrayDataSource" as file-extension, which is completely useless. How do i extract the correct file-extension out of my DataHandler? Thanks alot!
Error while uploading File using DataHandler
Hello! I work with Axis 1.4.1 and Tomcat 5.5. In the service there is a method which is used to upload image-data to the server using javax.activation.DataHandler. I generated a ClientStub using the eclipse-built-in "Create new Webservice-Client" and communicate successfully with other methods from the service. When I want to upload an image i get the following Exception on the serverside: ERROR 2009-06-24 17:37:34,491 [http-8180-Processor25] (RPCMessageReceiver.java:160) - java.lang.IllegalArgumentException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun .reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java: 39) at sun .reflect .DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java: 25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java: 194) at org .apache .axis2 .rpc .receivers .RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:102) at org .apache .axis2 .receivers .AbstractInOutMessageReceiver .invokeBusinessLogic(AbstractInOutMessageReceiver.java:40) at org .apache .axis2 .receivers .AbstractMessageReceiver.receive(AbstractMessageReceiver.java:100) at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:176) at org .apache .axis2 .transport .http .HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275) at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:133) at javax.servlet.http.HttpServlet.service(HttpServlet.java:709) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org .apache .catalina .core .ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java: 269) at org .apache .catalina .core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org .apache .catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java: 213) at org .apache .catalina.core.StandardContextValve.invoke(StandardContextValve.java: 172) at org .apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java: 127) at org .apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java: 117) at org .apache .catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java: 151) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java: 874) at org.apache.coyote.http11.Http11BaseProtocol $Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665) at org .apache .tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528) at org .apache .tomcat .util .net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java: 81) at org.apache.tomcat.util.threads.ThreadPool $ControlRunnable.run(ThreadPool.java:689) at java.lang.Thread.run(Thread.java:619) ERROR 2009-06-24 17:37:34,496 [http-8180-Processor25] (AxisEngine.java: 212) - org.apache.axis2.AxisFault at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430) at org .apache .axis2 .rpc .receivers .RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:161) at org .apache .axis2 .receivers .AbstractInOutMessageReceiver .invokeBusinessLogic(AbstractInOutMessageReceiver.java:40) at org .apache .axis2 .receivers .AbstractMessageReceiver.receive(AbstractMessageReceiver.java:100) at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:176) at org .apache .axis2 .transport .http .HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275) at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:133) at javax.servlet.http.HttpServlet.service(HttpServlet.java:709) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org .apache .catalina .core .ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java: 269) at org .apache .catalina .core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org .apache .catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java: 213) at org .apache .catalina.core.StandardContextValve.invoke(StandardContextValve.java: 172) at org .apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java: 127) at org .apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java: 117) at org .apache .catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java: 151) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java: 874) at org.apache.coyote.http11.Http11BaseProtocol $Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665) at org .apache .tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpE