Apache SOAP API Reference

org.apache.soap.messaging
Class Message

java.lang.Object
  |
  +--org.apache.soap.messaging.Message

public class Message
extends java.lang.Object

A Message is the class whose instances represent one-way messages in SOAP. While messages are one-way, they are sometimes carried on two-way transports such as HTTP. To accomodate that, the API supported here has a "receive" method as well - that is only applicable if the transport that is being used supports the receive() method (@see org.apache.soap.transport.SOAPTransport) so that this API can get at the 'response' envelope.

Author:
Sanjiva Weerawarana (sanjiva@watson.ibm.com)

Constructor Summary
Message()
           

 

Method Summary
 void addBodyPart(javax.mail.internet.MimeBodyPart part)
          Add a MIME BodyPart to the request MIME envelope.
 javax.mail.internet.MimeBodyPart findBodyPart(java.lang.String uri)
          Find the MIME part referred to by the given URI in the response MIME envelope.
 javax.mail.internet.MimeBodyPart getBodyPart(int index)
          Get the specified Part in the reponse MIME envelope by its index.
 int getPartCount()
          Return the number of enclosed BodyPart objects in the response MIME envelope.
 SOAPContext getRequestSOAPContext()
          Get the request SOAPContext.
 SOAPContext getResponseSOAPContext()
          Get the response SOAPContext.
 javax.mail.internet.MimeBodyPart getRootPart()
          Get the root Part of the reponse MIME envelope, or the only part if the response wasn't multipart.
 org.apache.soap.transport.SOAPTransport getSOAPTransport()
           
 javax.activation.DataHandler receive()
          Receive a response from the given transport.
 Envelope receiveEnvelope()
          Receive an envelope from the given transport.
 void send(java.net.URL url, java.lang.String actionURI, Envelope env)
          Send an envelope to the given URL via the SOAPTransport that has been configured for this instance (or SOAPHTTPConnection by default).
 void setSOAPTransport(org.apache.soap.transport.SOAPTransport st)
           

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Constructor Detail

Message

public Message()
Method Detail

setSOAPTransport

public void setSOAPTransport(org.apache.soap.transport.SOAPTransport st)

getSOAPTransport

public org.apache.soap.transport.SOAPTransport getSOAPTransport()

send

public void send(java.net.URL url,
                 java.lang.String actionURI,
Envelope env)
          throws SOAPException
Send an envelope to the given URL via the SOAPTransport that has been configured for this instance (or SOAPHTTPConnection by default). The envelope is sent exactly as-is.
Parameters:
url - the url to send to
actionURI - the value of the SOAPAction header
env - envelope to send
Throws:
SOAPException - if something goes wrong.

receiveEnvelope

public Envelope receiveEnvelope()
                         throws SOAPException
Receive an envelope from the given transport. Only applicable where the transport supports the receive method. If the (root part of) the response does not have text/xml as the Content-Type, null will be returned. If the response is not a SOAP envelope, receive() should be used instead.
Returns:
the envelope received
Throws:
SOAPException - if something goes wrong
See Also:
receive()

receive

public javax.activation.DataHandler receive()
                                     throws SOAPException,
                                            javax.mail.MessagingException
Receive a response from the given transport. Only applicable where the transport supports the receive method.
Returns:
the root part of the response as a DataHandler
Throws:
SOAPException - if something goes wrong
javax.mail.MessagingException
See Also:
receive()

getRequestSOAPContext

public SOAPContext getRequestSOAPContext()
Get the request SOAPContext.
Returns:
SOAPContext

addBodyPart

public void addBodyPart(javax.mail.internet.MimeBodyPart part)
                 throws javax.mail.MessagingException
Add a MIME BodyPart to the request MIME envelope.
Parameters:
part - The Part to be appended
Throws:
javax.mail.MessagingException

getResponseSOAPContext

public SOAPContext getResponseSOAPContext()
Get the response SOAPContext.
Returns:
SOAPContext

findBodyPart

public javax.mail.internet.MimeBodyPart findBodyPart(java.lang.String uri)
Find the MIME part referred to by the given URI in the response MIME envelope. This can be: Returns null if the part is not found.

Note: relative URIs not entirely implemented yet.

Parameters:
uri - the URI
Returns:
the Part or null if not found

getPartCount

public int getPartCount()
                 throws javax.mail.MessagingException
Return the number of enclosed BodyPart objects in the response MIME envelope.
Returns:
number of parts
Throws:
javax.mail.MessagingException

getBodyPart

public javax.mail.internet.MimeBodyPart getBodyPart(int index)
                                             throws java.lang.IndexOutOfBoundsException
Get the specified Part in the reponse MIME envelope by its index. Parts are numbered starting at 0.
Parameters:
index - the index of the desired Part
Returns:
the Part
Throws:
java.lang.IndexOutOfBoundsException - if no such Part exists

getRootPart

public javax.mail.internet.MimeBodyPart getRootPart()
                                             throws javax.mail.MessagingException
Get the root Part of the reponse MIME envelope, or the only part if the response wasn't multipart.
Returns:
the Part
javax.mail.MessagingException

Apache SOAP API Reference

Copyright © 2001 Apache XML Project. All Rights Reserved.