Name

SOAPEnvelope

Synopsis

public interface SOAPEnvelope extends SOAPElement {
// Public Instance Methods
    public abstract SOAPBody addBody(  ) throws SOAPException; 
    public abstract SOAPHeader addHeader(  )(  ) throws SOAPException; 
    public abstract Name createName(String localName) throws SOAPException; 
    public abstract Name createName(String localName, String prefix, String uri) 
        throws SOAPException; 
    public abstract SOAPBody getBody(  ) throws SOAPException; 
    public abstract SOAPHeader getHeader(  ) throws SOAPException; 
}

SOAPEnvelope is a subinterface of SOAPElement that maps to the envelope of a SOAP message. A reference to the SOAPEnvelope can be obtained from the SOAPPart of a message:

MessageFactory factory = MessageFactory .newInstance;
SOAPMessage msg = factory.createMessage;
SOAPEnvelope envelope = msg.getSOAPPart.getEnvelope;

SOAPEnvelope is a container for the header and body parts of the SOAP message, references to which can be obtained from the getHeader( ) and getBody( ) methods. A newly created SOAPMessage contains an empty header and an empty body. The addHeader( ) and addBody( ) methods can be used to create and add a new SOAPHeader or SOAPBody body element to the envelope. However, since only one object of each type can be present in the envelope at any time, the existing instance must be removed by calling the detachNode( ) method before a new one is created.

SOAPEnvelope also acts as a factory for Name objects. The single-argument createName( ) method creates a Name object ...

Get Java Web Services in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.