Exemplo n.º 1
0
  void writeAttachmentBody(MessageContext context, OutMessage message) throws XFireException {
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    writeWithoutAttachments(context, message, bos);

    Attachments atts = message.getAttachments();

    ByteDataSource ds = new ByteDataSource(bos.toByteArray());
    ds.setContentType(getSoapMimeType(message));
    DataHandler dh = new DataHandler(ds);

    SimpleAttachment att = new SimpleAttachment("soap-message.xml", dh);

    atts.setSoapMessage(att);
  }