public String saveNonEmbededResponse(
      String downloadDirectory, String localFileName, boolean decomposed)
      throws IOException, SOAPException, RemoteException {
    String downloadName = null;
    BufferedOutputStream outStream = null;
    String localFilePath = downloadDirectory + "/" + localFileName;
    try {
      if (!decomposed) {
        outStream = new BufferedOutputStream(new FileOutputStream(localFilePath));
      }

      Object[] attachments = proxy.getAttachments();
      for (int i = 0; i < attachments.length; i++) {
        if (attachments[i] != null) {
          AttachmentPart temp = (AttachmentPart) attachments[i];
          System.out.println("Attachment retrived as " + temp.getContentId());
          InputStream inStream = temp.getDataHandler().getInputStream();
          if (!decomposed) {
            if (outStream != null) {
              saveToStream(inStream, outStream);
            }
          } else {
            String decomposedDocAttachment = downloadDirectory + "/" + temp.getContentId();
            BufferedOutputStream tempOutStream =
                new BufferedOutputStream(new FileOutputStream(decomposedDocAttachment));
            saveToStream(inStream, tempOutStream);
            tempOutStream.close();
          }
        }
      }

    } catch (SOAPException e) {
      throw AxisFault.makeFault(e);
    } catch (RemoteException e) {
      throw e;
    } finally {
      proxy.clearAttachments();
      if (outStream != null) {
        downloadName = localFilePath;
        outStream.close();
      }
    }
    return downloadName;
  }