axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ekbote, Niranjan" <NEkb...@doubleclick.net>
Subject RE: help required for attachment using ejb as webservice
Date Wed, 07 May 2003 13:18:52 GMT
Hi, 
	We experienced the same exact problem. We need to transfer files. We
too are exposing our stateless session EJBs as webservices. Now you CANNOT
have a DataHandler object returned by an EJB and consumed by some other user
directly accessing the EJB because it does not implement the
java.io.Serializable interface. So to have an EJB which returns a
DataHandler object is basically useless from purely the J2EE perspective
because it is invariable going to throw an exception. However, Axis supports
attachments using the DataHandler object. So this is kind of a paradox. So
there is no way to expose an EJB directly as an Axis web service which deals
with DataHandler attachments. The way we worked around this was to have a
general simple class (not an EJB) which we exposed as a web service. Now
since this class is not an EJB it can return DataHandler objects. Now the
implementation of this class, can call the EJB using JNDI, get the data as a
byte array or some java.io.Serialzable object which EJB can return safely
then encapsulate it in a DataHandler object and return it, which Axis then
sends as an attachment. 

However, even then the WSDL automaticalluy generated by Axis in for
DataHandler return types is totally usely when used with WSDL2Java. In
general, WSDL2Java does not have any attachment support at all. 

Thanks! 

-- Niranjan. 


-----Original Message-----
From: subhendukumar mohanty [mailto:subhendukm@infosys.com]
Sent: Wednesday, May 07, 2003 9:04 AM
To: axis-user@ws.apache.org
Subject: RE: help required for attachment using ejb as webservice



Thanks Toshi,

I got your mail regarding the sample example. My return type bean is
serializable. but it's data member is not serializable. I can try this but
it will not solve my requirement as we have to return more image with there
meta data . So it has to be wrapped by custom object.

Let me know if you have more idea.
Thanks,
Subhendu


-----Original Message-----
From: Toshiyuki Kimura [mailto:kimuratsy@nttdata.co.jp]
Sent: Tuesday, April 08, 2003 12:10 AM
To: axis-user@ws.apache.org
Subject: RE: help required for attachment using ejb as webservice


Hi Subhendu,

  Please show us the snippet of the ejb code and the stacktrace
of the exception.  And I have no trouble with my environment;
axis 1.1 rc2 on WebLogic 7.0 SP1.  If it's possible to you,
could you check the behavior of your ejb on the same env. ?

Best Regards,
 
   Toshi (Toshiyuki Kimura) <kimuratsy@nttdata.co.jp>
   R&D Headquarters
   NTT DATA Corporation

-----Original Message-----
From: subhendukumar mohanty [mailto:subhendukm@infosys.com]
Sent: Saturday, April 05, 2003 2:24 AM
To: axis-user@ws.apache.org; Toshiyuki Kimura
Subject: RE: help required for attachment using ejb as webservice

Yes if i am not making this as ejb then it is ok. The only problem
is with ejb

-----Original Message-----
From: Toshiyuki Kimura [mailto:kimuratsy@nttdata.co.jp]
Sent: Friday, April 04, 2003 12:08 PM
To: axis-user@ws.apache.org
Subject: Re: help required for attachment using ejb as webservice

Hi Subhendu,

  Could you make sure that you have the right setting
of the serializer for a DataHandler on wsdd ?  And one
more question, are you successful with a non-ejb impl ?

Best Regards,
 
   Toshi (Toshiyuki Kimura) <kimuratsy@nttdata.co.jp>
   R&D Headquarters
   NTT DATA Corporation

----- Original Message ----- 
From: "subhendukumar mohanty" <subhendukm@infosys.com>
To: <axis-user@ws.apache.org>
Sent: Friday, April 04, 2003 10:36 PM
Subject: RE: help required for attachment using ejb as webservice
>
> Thanks for your suggestion
> 
> Actually i had tried making a DataHandler as return type of EJB method.
> For the time being think that there is no webservice. I wrote the sample
> ejb and run that sample and it gave me nonserializable exception.That's
> why i could not use this. For ejb all the return type has to extend
> Java.io.serializable.
> 
> Let me know if i am not correct
> 
> -----Original Message-----
> From: Toshiyuki Kimura [mailto:kimuratsy@nttdata.co.jp]
> Sent: Thursday, April 03, 2003 10:43 PM
> To: axis-user@ws.apache.org
> Subject: RE: help required for attachment using ejb as webservice
> 
> Hi Subhendu,
> 
>   You're incorrect.  You can't make it the return type in
> ejb method.  Why not ?  I can do that.  I don't know why
> you didn't try anyway ?
> 
>   I believe, you're confusing the meaning of the word;
> 'serialize' in the Web Services area with 'serializable'
> in the general Java programming.
>   The diff. of serialize/deserialize in the 2 areas are;
> 
>  WS area : [Program lang. specific objects] <-> [XML(SOAP)]
>  Java gen: [Java objects] <-> [byte array]
> 
>   These are quite different, despite the misleading word.
> Can you make sense of the meaning ?
> 
> Best Regards,
> 
>   Toshi (Toshiyuki Kimura) <kimuratsy@nttdata.co.jp>
>   R&D Headquarters
>   NTT DATA Corporation
> 
> -----Original Message-----
> From: subhendukumar mohanty [mailto:subhendukm@infosys.com]
> Sent: Friday, April 04, 2003 2:06 AM
> To: axis-user@ws.apache.org
> Subject: RE: help required for attachment using ejb as webservice
> 
> I have session bean. One thing i am not clear. If datahandler
> is not a serializable , i can not make it the return type in
> ejb method. Am i correct or not in the above statement ?
> 
> -----Original Message-----
> From: Toshiyuki Kimura [mailto:kimuratsy@nttdata.co.jp]
> Sent: Thursday, April 03, 2003 7:20 AM
> To: axis-user@ws.apache.org
> Subject: RE: help required for attachment using ejb as webservice
> 
> Hi Subhendu,
> 
>   At the beginning, I'd like to notify that I've already succeeded
> in EJB usage with the AXIS 1.1 rc1 and the posted code.  Thus, it
> seems the root problem is not the return type of an ejb method.
> 
>   The most interesting describes from you are the followings;
> 
> | Type of Image (Jpeg). We get the image as byte array from
> |   other source. We do not get file reference.
> 
>   I guess that you're saving the jpeg images on DBMS, and also
> the ejb is implemented as an Entity Bean.  Is that right ?
> If so, the restriction of 'serializable' is for an Entity Bean
> rather than for an ejb on AXIS.
> 
> Best Regards,
> 
>   Toshi (Toshiyuki Kimura) <kimuratsy@nttdata.co.jp>
>   R&D Headquarters
>   NTT DATA Corporation
> 
> -----Original Message-----
> From: subhendukumar mohanty [mailto:subhendukm@infosys.com]
> Sent: Thursday, April 03, 2003 12:07 AM
> To: axis-user@ws.apache.org
> Subject: RE: help required for attachment using ejb as webservice
> provider
> 
> Hi Toshiyuki
> 
> My Answers are as below
> 
> Axis 1.0 (But we may go for Apache Soap latest version comes
>  with websphere 4.0)
> Type of Image (Jpeg). We get the image as byte array from other
>  source. We do not get file reference.
> 
> Problem. If i expose my ejb method as webservice interface and
>  i have to use soap with attachment then the return type of EJB
>  method will be of Datahandler Type. But DataHandler can  not be
>  return type of an ejb method as it does not implement
>  java.io.serializable and all ejb retutn parameters needs to be
>  serializable.
> 
> So to avoid this i was thinking that let my ejb return byte array
>  and i have to write a wrapper java class which will convert the
>  byte array to datahandler (still no clear how to convert that).
>  The wrapper java class will be exposed as web service rather than
>  exposing the ejb as webservice.
> 
> Let me know whethere i am procceding in a correct direction.
> 
> Thanks,
> Subhendu
> 
> -----Original Message-----
> From: Toshiyuki Kimura [mailto:kimuratsy@nttdata.co.jp]
> Sent: Tuesday, March 25, 2003 6:27 AM
> To: axis-user@ws.apache.org
> Subject: Re: help required for attachment using ejb as webservice
> provider
> 
> Hi Subhendu,
> 
>   In order to clear questions from you, we'll need more details of
> your situation;
> 
>   - Version of AXIS: 1.0, 1.1Beta, RC1, RC2, or the current ver ?
>   - Type of Image  : 'JPEG', 'GIF', or the other specific types ?
>   - Real problem   : 'Exceptions', or 'Functionally defectives' ?
> 
>   If you're using AXIS 1.1 Beta (or the later) and 'image/jpeg
> or image/gif' as the content type (i.e. your image archive only
> has JPEG files and/or GIF files), you might make it with the 
> following snapshot;
> 
> public DataHandler downladFile(java.lang.String filename){
>   try{
>     FileDataSource dataSource = new FileDataSource(filename);
>     DataHandler dataHandler = new DataHandler(dataSource);
>     return dataHandler;
>   }catch(Exception e){
>       :
>   }
> }
> 
>   Please note DataHandler hasn't been implemented as serializable,
> however, some standardized types of content (MIME type) will be
> automatically serialized and deserialized by the runtime, AXIS
> with your right configuration.
> 
> Best Regards,
> 
>   Toshi (Toshiyuki Kimura) <kimuratsy@nttdata.co.jp>
>   R&D Headquarters
>   NTT DATA Corporation
> 
> -----Original Message-----
> From: subhendukumar mohanty [mailto:subhendukm@infosys.com]
> Sent: Friday, March 21, 2003 10:05 AM
> To: axis-user@ws.apache.org
> Subject: help required for attachment using ejb as
>          webservice provider
> 
> We are creating a ejb which will be exposed as webservice.
> One of the method of ejb will return the image from image
> archive. So we need to use soap with attachment for this.
> I learned that if any data is returned using DataHandler
> it will be automatically passed as soap with attachment.
> As DataHandler is not implemented java.io.serializable,
> I can not use this as the return type of the ejb. I am new
> to webservice and axis. So any body can guide me what to do
> in this case..
> 
> Your help will be appreciated.
> 
> Thanks,
> Subhendu
> 


Mime
View raw message