HomeDigital EditionSys-Con RadioSearch Web Services Cd
B2B Beginning WS Business Process Management Case Studies Content Management Distributing Computing e-Business Electronic Data Interchange Enterprise Industry Insight Integration Interviews Java & Web Services .NET Portal Product Reviews Scalability & Performance Security SOAP Source Code UDDI Wireless WS Standards WS Tips & Techniques WSDL WS Editorials XML

SOAP on a ROPE, by Wyn Easton
WSJ Vol 02 Issue 01 - pg.30

	


Listing 1
  
  public byte[] ObjectToArray(Object obj) throws 
Exception
   {
   
  ObjectOutputStream oos = null;
   
  try
   
  {
   
   
  ByteArrayOutputStream bos = new ByteArrayOutputStream();
   
   oos = new 
  ObjectOutputStream(bos);
   
   // serialize 
  the object passed in
   
   
  oos.writeObject(obj); 
   
   oos.flush(); 
  
   
   return 
  bos.toByteArray();
   
  }
   
  catch (Exception e)
   
  {
   
   
  System.out.println("Exception in ObjToArray = " + e);
   
   throw(e);
   
  }
   
  finally
   
  {
   
   
  oos.close();
   
  }
   }
  
  
  Listing 2
  
  try
   
  {
   
   
  ByteArrayInputStream bin = new 
  ByteArrayInputStream(Base64.decode(value));
   
   ois = new 
  ObjectInputStream(bin); // Create an Object Input Stream
   
   // return the 
  new object
   
   Object object 
  = (Object)ois.readObject();
    
  return new 
  Bean(Object.class, object);
   
  }
   
  catch (ClassNotFoundException cnfe)
   
  {
   
   
  System.out.println("Class Not Found Exception in unmarshall = " + 
  cnfe);
   
   // this is 
  where I was getting the class file originally
   
  }