org.apache.axis
Class SOAPPart

java.lang.Object
  |
  +--org.apache.axis.Part
        |
        +--org.apache.axis.SOAPPart

public class SOAPPart
extends Part

The SOAPPart provides access to the root part of the Message which contains the envelope.

SOAPPart implements Part, providing common MIME operations.

SOAPPart also allows access to its envelope, as a string, byte[], InputStream, or SOAPEnvelope. (This functionality used to be in Message, and has been moved here more or less verbatim pending further cleanup.)

Author:
Rob Jellinghaus (robj@unrealities.com), Doug Davis (dug@us.ibm.com), Glen Daniels (gdaniels@allaire.com)

Field Summary
protected static org.apache.commons.logging.Log log
           
 
Constructor Summary
SOAPPart(Message parent, java.lang.Object initialContents, boolean isBodyStream)
          Do not call this directly! Should only be called by Message.
 
Method Summary
 byte[] getAsBytes()
          Get the contents of this Part (not the headers!), as a byte array.
 SOAPEnvelope getAsSOAPEnvelope()
          Get the contents of this Part (not the MIME headers!), as a SOAPEnvelope.
 java.lang.String getAsString()
          Get the contents of this Part (not the headers!), as a String.
 int getContentLength()
          Get the content length for this SOAPPart.
 java.lang.String getContentType()
          Content type is always "text/xml" for SOAPParts.
 java.lang.Object getCurrentMessage()
          Get the current message, in whatever form it happens to be right now.
 Message getMessage()
          Get the Message for this Part.
 int getSize()
          Get the total size in bytes, including headers, of this Part.
 void setMessage(Message msg)
          Set the Message for this Part.
 void setSOAPEnvelope(SOAPEnvelope env)
          This set the SOAP Envelope for this part.
 void writeTo(java.io.OutputStream out)
          Write out the contents & headers to out.
 
Methods inherited from class org.apache.axis.Part
addMimeHeader, getContentId, getContentLocation, getMatchingMimeHeaders, getMimeHeader, getNewContentIdValue, getNonMatchingMimeHeaders, setContentId, setContentLocation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static org.apache.commons.logging.Log log
Constructor Detail

SOAPPart

public SOAPPart(Message parent,
                java.lang.Object initialContents,
                boolean isBodyStream)
Do not call this directly! Should only be called by Message. As this method's comment once read: "Just something to us working..."
Method Detail

getMessage

public Message getMessage()
Get the Message for this Part.

setMessage

public void setMessage(Message msg)
Set the Message for this Part. Do not call this Directly. Called by Message.

getContentType

public java.lang.String getContentType()
Content type is always "text/xml" for SOAPParts.
Overrides:
getContentType in class Part

getContentLength

public int getContentLength()
Get the content length for this SOAPPart. This will force buffering of the SOAPPart, but it will also cache the byte[] form of the SOAPPart.

setSOAPEnvelope

public void setSOAPEnvelope(SOAPEnvelope env)
This set the SOAP Envelope for this part. Note: It breaks the chicken/egg created. I need a message to create an attachment... From the attachment I should be able to get a reference... I now want to edit elements in the envelope in order to place the attachment reference to it. How do I now update the SOAP envelope with what I've changed?

getSize

public int getSize()
Get the total size in bytes, including headers, of this Part. TODO: For now, since we aren't actually doing MIME yet, this is the same as getContentLength(). Soon it will be different.

writeTo

public void writeTo(java.io.OutputStream out)
             throws java.io.IOException
Write out the contents & headers to out. TODO: actually write headers! probably also add parameter to indicate whether to bother....

getCurrentMessage

public java.lang.Object getCurrentMessage()
Get the current message, in whatever form it happens to be right now. Will return a String, byte[], InputStream, or SOAPEnvelope, depending on circumstances.

The method name is historical. TODO: rename this for clarity; should be more like getContents.


getAsBytes

public byte[] getAsBytes()
                  throws AxisFault
Get the contents of this Part (not the headers!), as a byte array. This will force buffering of the message.

getAsString

public java.lang.String getAsString()
                             throws AxisFault
Get the contents of this Part (not the headers!), as a String. This will force buffering of the message.

getAsSOAPEnvelope

public SOAPEnvelope getAsSOAPEnvelope()
                               throws AxisFault
Get the contents of this Part (not the MIME headers!), as a SOAPEnvelope. This will force a complete parse of the message.


Copyright © 2001 Apache XML Project. All Rights Reserved.