コード例 #1
0
ファイル: Message.java プロジェクト: hugosato/apache-axis
  /**
   * Creates a new empty <CODE>AttachmentPart</CODE> object. Note that the method <CODE>
   * addAttachmentPart</CODE> must be called with this new <CODE>AttachmentPart</CODE> object as the
   * parameter in order for it to become an attachment to this <CODE>SOAPMessage</CODE> object.
   *
   * @return a new <CODE>AttachmentPart</CODE> object that can be populated and added to this <CODE>
   *     SOAPMessage</CODE> object
   */
  public AttachmentPart createAttachmentPart() {
    if (!isAttachmentSupportEnabled(getMessageContext())) {
      throw new RuntimeException(Messages.getMessage("noAttachments"));
    }

    try {
      return (AttachmentPart) mAttachments.createAttachmentPart();
    } catch (AxisFault af) {
      log.error(Messages.getMessage("exception00"), af);
    }
    return null;
  }