I am in need of answers. Someone look into this please. Thanks, Pani
--- Chakrapani Madaraju <[EMAIL PROTECTED]> wrote: > Hi, > > I have a Java Program which returns a DynaBean > Array > to the callers. To deploy this as WebService I had > to convert the DynaBean into the following to send > it > as DataHandler Object (pls suggest if there is a > better way). > > DynaBean[] db = (DynaBean[])newResults.toArray(new > DynaBean[newResults.size()]); > > ByteArrayOutputStream baos = new > ByteArrayOutputStream(); > > ObjectOutputStream oos = new > ObjectOutputStream(baos); > oos.writeObject(db); > oos.flush(); > oos.close(); > > //InputStream bais = new > ByteArrayInputStream(baos.toByteArray()); > > InternetHeaders header = new InternetHeaders(); > header.addHeader("Content-Type", > "application/octet-stream"); > > mbp = new MimeBodyPart(header, baos.toByteArray()); > DataHandler dh = new DataHandler(new > MimePartDataSource(mbp)); > > return dh; > > > On the client side I am using the following code to > read the result. > > DataHandler qr = (DataHandler)svc.executeQuery(); > DataSource ds = qr.getDataSource(); > MimeBodyPart mp = new > MimeBodyPart(ds.getInputStream()); > > InputStream oas = mp.getInputStream(); > ObjectInputStream ois = new ObjectInputStream(oas); > Object db = ois.readObject(); > //I am expecting the above Object to be the > DynaBean[] > ois.close(); > > I keep getting java.io.EOFException in the > following > line > > ObjectInputStream ois = new ObjectInputStream(oas); > > Not sure why. My main aim is to send the DynaBean[] > back to the caller. I am using DynaBean since I > don't know of any structure that can send results > (it > is a search utility). I am using AXIS 1.2. > > Thanks in advance, > Pani > > > > > >