Ejemplo n.º 1
0
 /**
  * Writes this <CODE>SOAPMessage</CODE> object to the given output stream. The externalization
  * format is as defined by the SOAP 1.1 with Attachments specification.
  *
  * <p>If there are no attachments, just an XML stream is written out. For those messages that have
  * attachments, <CODE>writeTo</CODE> writes a MIME-encoded byte stream.
  *
  * @param os the <CODE>OutputStream</CODE> object to which this <CODE>SOAPMessage</CODE> object
  *     will be written
  * @throws SOAPException if there was a problem in externalizing this SOAP message
  * @throws IOException if an I/O error occurs
  */
 public void writeTo(java.io.OutputStream os) throws SOAPException, IOException {
   // Do it the old fashion way.
   if (getSendType() == Attachments.SEND_TYPE_NONE
       || mAttachments == null
       || 0 == mAttachments.getAttachmentCount()) {
     try {
       String charEncoding = XMLUtils.getEncoding(this, msgContext);
       ;
       mSOAPPart.setEncoding(charEncoding);
       mSOAPPart.writeTo(os);
     } catch (java.io.IOException e) {
       log.error(Messages.getMessage("javaIOException00"), e);
     }
   } else {
     try {
       mAttachments.writeContentToStream(os);
     } catch (java.lang.Exception e) {
       log.error(Messages.getMessage("exception00"), e);
     }
   }
 }