SOAPPart (Axis API)
Keywords: org.apache.axis.SOAPPart,SOAPPart class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.axis
Class SOAPPart

    java.lang.Object
      |
      +--javax.xml.soap.SOAPPart
            |
            +--org.apache.axis.SOAPPart

All Implemented Interfaces:
  Part, java.io.Serializable

public class SOAPPart
extends SOAPPart
implements 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)
See Also:
  Serialized Form

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
`void` | `addMimeHeader(java.lang.String header, java.lang.String value)` Add the specified MIME header, as per JAXM.
`java.util.Iterator` | `getAllMimeHeaders()` Retrieves all the headers for this `SOAPPart` object as an iterator over the `MimeHeader` objects.
`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.
`Source` | `getContent()` Returns the content of the SOAPEnvelope as a JAXP `Source` object.
`java.lang.String` | `getContentId()` Content ID.
`java.lang.String` | `getContentIdRef()` Content ID.
`int` | `getContentLength()` Get the content length for this SOAPPart.
`java.lang.String` | `getContentLocation()` Content location.
`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.
`SOAPEnvelope` | `getEnvelope()` Gets the `SOAPEnvelope` object associated with this `SOAPPart` object.
`java.util.Iterator` | `getMatchingMimeHeaders(java.lang.String[] match)` Get all headers that match
`Message` | `getMessage()` Get the Message for this Part.
`java.lang.String[]` | `getMimeHeader(java.lang.String name)` Gets all the values of the `MimeHeader` object in this `SOAPPart` object that is identified by the given `String`.
`java.util.Iterator` | `getNonMatchingMimeHeaders(java.lang.String[] match)` Get all headers that do not match
`int` | `getSize()` Get the total size in bytes, including headers, of this Part.
`void` | `removeAllMimeHeaders()` Removes all the `MimeHeader` objects for this `SOAPEnvelope` object.
`void` | `removeMimeHeader(java.lang.String header)` Removes all MIME headers that match the given name.
`void` | `setContent(Source source)` Sets the content of the `SOAPEnvelope` object with the data from the given `Source` object.
`void` | `setContentId(java.lang.String newCid)` Sets Content-Id of this part.
`void` | `setContentLocation(java.lang.String loc)` Set content location.
`void` | `setMessage(Message msg)` Set the Message for this Part.
`void` | `setMimeHeader(java.lang.String name, java.lang.String value)` Changes the first header entry that matches the given header name so that its value is the given value, adding a new header with the given name and value if no existing header is a match.
`void` | `setSOAPEnvelope(SOAPEnvelope env)` This set the SOAP Envelope for this part.
`void` | `writeTo(java.io.Writer writer)` Write the contents to the specified writer.

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.

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.

  Specified by:
    `getContentType` in interface `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.Writer writer)
                 throws java.io.IOException

  Write the contents to the specified writer.

    `java.io.IOException`

### 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.

    `AxisFault`

### 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.

    `AxisFault`

### 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.

    `AxisFault`

### addMimeHeader

    public void addMimeHeader(java.lang.String header,
                              java.lang.String value)

  Add the specified MIME header, as per JAXM.

  Specified by:
    `addMimeHeader` in interface `Part`
  Specified by:
    `addMimeHeader` in class `SOAPPart`
  Parameters:
    `header` - a `String` giving the header name
    `value` - a `String` giving the value to be set or added

### getContentLocation

    public java.lang.String getContentLocation()

  Content location.

  Specified by:
    `getContentLocation` in interface `Part`
  Overrides:
    `getContentLocation` in class `SOAPPart`
  Returns:
    a `String` giving the value of the MIME header whose name is "Content-Location"
  See Also:
    `setContentLocation(java.lang.String)`

### setContentLocation

    public void setContentLocation(java.lang.String loc)

  Set content location.

  Specified by:
    `setContentLocation` in interface `Part`
  Overrides:
    `setContentLocation` in class `SOAPPart`
  Parameters:
    `loc` - a `String` giving the value of the MIME header "Content-Location"
  See Also:
    `getContentLocation()`

### setContentId

    public void setContentId(java.lang.String newCid)

  Sets Content-Id of this part. already defined.

  Specified by:
    `setContentId` in interface `Part`
  Overrides:
    `setContentId` in class `SOAPPart`
  Parameters:
    `newCid` - new Content-Id

### getContentId

    public java.lang.String getContentId()

  Content ID.

  Specified by:
    `getContentId` in interface `Part`
  Overrides:
    `getContentId` in class `SOAPPart`
  Returns:
    a `String` giving the value of the MIME header named "Content-Id"
  See Also:
    `setContentId(java.lang.String)`

### getContentIdRef

    public java.lang.String getContentIdRef()

  Content ID.

  Specified by:
    `getContentIdRef` in interface `Part`
  Returns:
    the contentId reference value that should be used directly as an href in a SOAP element to reference this attachment. Not part of JAX-RPC, JAX-M, SAAJ, etc.

### getMatchingMimeHeaders

    public java.util.Iterator getMatchingMimeHeaders(java.lang.String[] match)

  Get all headers that match

  Specified by:
    `getMatchingMimeHeaders` in interface `Part`
  Specified by:
    `getMatchingMimeHeaders` in class `SOAPPart`
  Parameters:
    `match` - a `String` array with the name(s) of the MIME headers to be returned
  Returns:
    all of the MIME headers that match one of the names in the given array, returned as an `Iterator` object

### getNonMatchingMimeHeaders

    public java.util.Iterator getNonMatchingMimeHeaders(java.lang.String[] match)

  Get all headers that do not match

  Specified by:
    `getNonMatchingMimeHeaders` in interface `Part`
  Specified by:
    `getNonMatchingMimeHeaders` in class `SOAPPart`
  Parameters:
    `match` - a `String` array with the name(s) of the MIME headers not to be returned
  Returns:
    all of the MIME headers in this `SOAPPart` object except those that match one of the names in the given array. The nonmatching MIME headers are returned as an `Iterator` object.

### setContent

    public void setContent(Source source)
                    throws SOAPException

  Sets the content of the `SOAPEnvelope` object with the data from the given `Source` object.

  Specified by:
    `setContent` in class `SOAPPart`
  Parameters:
    `source` - javax.xml.transform.Source object with the data to be set
  Throws:
    `SOAPException` - if there is a problem in setting the source
  See Also:
    `getContent()`

### getContent

    public Source getContent()
                      throws SOAPException

  Returns the content of the SOAPEnvelope as a JAXP `Source` object.

  Specified by:
    `getContent` in class `SOAPPart`
  Returns:
    the content as a `javax.xml.transform.Source` object
  Throws:
    `SOAPException` - if the implementation cannot convert the specified `Source` object
  See Also:
    `setContent(javax.xml.transform.Source)`

### getAllMimeHeaders

    public java.util.Iterator getAllMimeHeaders()

  Retrieves all the headers for this `SOAPPart` object as an iterator over the `MimeHeader` objects.

  Specified by:
    `getAllMimeHeaders` in class `SOAPPart`
  Returns:
    an `Iterator` object with all of the Mime headers for this `SOAPPart` object

### setMimeHeader

    public void setMimeHeader(java.lang.String name,
                              java.lang.String value)

  Changes the first header entry that matches the given header name so that its value is the given value, adding a new header with the given name and value if no existing header is a match. If there is a match, this method clears all existing values for the first header that matches and sets the given value instead. If more than one header has the given name, this method removes all of the matching headers after the first one.

  Note that RFC822 headers can contain only US-ASCII characters.

  Specified by:
    `setMimeHeader` in class `SOAPPart`
  Parameters:
    `name` - a `String` giving the header name for which to search
    `value` - a `String` giving the value to be set. This value will be substituted for the current value(s) of the first header that is a match if there is one. If there is no match, this value will be the value for a new `MimeHeader` object.
  See Also:
    `getMimeHeader(java.lang.String)`

### getMimeHeader

    public java.lang.String[] getMimeHeader(java.lang.String name)

  Gets all the values of the `MimeHeader` object in this `SOAPPart` object that is identified by the given `String`.

  Specified by:
    `getMimeHeader` in interface `Part`
  Specified by:
    `getMimeHeader` in class `SOAPPart`
  Parameters:
    `name` - the name of the header; example: "Content-Type"
  Returns:
    a `String` array giving all the values for the specified header
  See Also:
    `setMimeHeader(java.lang.String, java.lang.String)`

### removeAllMimeHeaders

    public void removeAllMimeHeaders()

  Removes all the `MimeHeader` objects for this `SOAPEnvelope` object.

  Specified by:
    `removeAllMimeHeaders` in class `SOAPPart`

### removeMimeHeader

    public void removeMimeHeader(java.lang.String header)

  Removes all MIME headers that match the given name.

  Specified by:
    `removeMimeHeader` in class `SOAPPart`
  Parameters:
    `header` - a `String` giving the name of the MIME header(s) to be removed

### getEnvelope

    public SOAPEnvelope getEnvelope()
                             throws SOAPException

  Gets the `SOAPEnvelope` object associated with this `SOAPPart` object. Once the SOAP envelope is obtained, it can be used to get its contents.

  Specified by:
    `getEnvelope` in class `SOAPPart`
  Returns:
    the `SOAPEnvelope` object for this `SOAPPart` object
  Throws:
    `SOAPException` - if there is a SOAP error

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003 Apache Web Services Project. All Rights Reserved.