View Javadoc

1   /*
2    * Copyright 2005-2012 the original author or authors.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.springframework.ws.soap;
18  
19  import org.springframework.ws.FaultAwareWebServiceMessage;
20  import org.springframework.ws.mime.MimeMessage;
21  
22  import org.w3c.dom.Document;
23  
24  /**
25   * Represents an abstraction for SOAP messages, providing access to a SOAP Envelope. The contents of the SOAP body can
26   * be retrieved by <code>getPayloadSource()</code> and <code>getPayloadResult()</code> on
27   * <code>WebServiceMessage</code>, the super-interface of this interface.
28   *
29   * @author Arjen Poutsma
30   * @see #getPayloadSource()
31   * @see #getPayloadResult()
32   * @see #getEnvelope()
33   * @since 1.0.0
34   */
35  public interface SoapMessage extends MimeMessage, FaultAwareWebServiceMessage {
36  
37      /** Returns the <code>SoapEnvelope</code> associated with this <code>SoapMessage</code>. */
38      SoapEnvelope getEnvelope() throws SoapEnvelopeException;
39  
40      /**
41       * Get the SOAP Action for this message, or <code>null</code> if not present.
42       *
43       * @return the SOAP Action.
44       */
45      String getSoapAction();
46  
47      /**
48       * Sets the SOAP Action for this message.
49       *
50       * @param soapAction the SOAP Action.
51       */
52      void setSoapAction(String soapAction);
53  
54      /**
55       * Returns the <code>SoapBody</code> associated with this <code>SoapMessage</code>. This is a convenience method for
56       * <code>getEnvelope().getBody()</code>.
57       *
58       * @see SoapEnvelope#getBody()
59       */
60      SoapBody getSoapBody() throws SoapBodyException;
61  
62      /**
63       * Returns the <code>SoapHeader</code> associated with this <code>SoapMessage</code>. This is a convenience method
64       * for <code>getEnvelope().getHeader()</code>.
65       *
66       * @see SoapEnvelope#getHeader()
67       */
68      SoapHeader getSoapHeader() throws SoapHeaderException;
69  
70      /**
71       * Returns the SOAP version of this message. This can be either SOAP 1.1 or SOAP 1.2.
72       *
73       * @return the SOAP version
74       * @see SoapVersion#SOAP_11
75       * @see SoapVersion#SOAP_12
76       */
77      SoapVersion getVersion();
78  
79      /**
80       * Returns this message as a {@link Document}.
81       *
82       * Depending on the underlying implementation, this Document may be 'live' or not.
83       * @return this soap message as a DOM document
84       */
85      Document getDocument();
86  
87      /**
88       * Sets the contents of the message to the given {@link Document}.
89       *
90       * @param document the soap message as a DOM document
91       */
92      void setDocument(Document document);
93  
94  }