Title: RE: MS Word document using SOAP

You can return your MS Word document as attachement.$
To do that you have just to return a DataHandler.

exemple:

   public DataHandler get(String NomFichier) throws Exception {
     
     
      File fichier = new File(RepertoireFichiers + "/" + NomFichier);
      if (!fichier.exists()) {
         throw new Exception("Ce fichier n'est pas disponible.");
      }
     
      DataSource source = new ByteArrayDataSource(fichier, null);
      DataHandler handler = new DataHandler(source);
      return handler;
   }

and the client code:

   static protected void detach(Response resp, File f) {
      try {
         MimeBodyPart mbp;
         DataHandler dh;
         Object o;
         InputStream is;
         FileOutputStream fos = new FileOutputStream(f);
     
         mbp = (MimeBodyPart)resp.getBodyPart(1);
         dh = mbp.getDataHandler();
         is = dh.getInputStream();
     
         int c;
         while ((c = is.read()) != -1)
            fos.write(c);
      } catch (Exception e) {
        System.out.println("Erreur client: " + e.getMessage());
      }
   }
       
  

-----Original Message-----
From: Rory Braybrook (DSLAK) [mailto:[EMAIL PROTECTED]]
Sent: vendredi 19 avril 2002 00:17
To: [EMAIL PROTECTED]
Subject: MS Word document using SOAP


Can the object returned from a SOAP call be a MS Word document ?

I am thinking of sending some parameters to a "document generator" (which
uses Word) which populates the document and then returns it. The client is
Java. The server is MS.

How would I do this ? Would I have to encode to something like Base64 ?

Any pointers or hints would be appreciated.

Thanks

Reply via email to