View Javadoc

1   /*
2    * Copyright 2007 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.addressing.version;
18  
19  import org.springframework.ws.soap.SoapFault;
20  import org.springframework.ws.soap.SoapHeaderElement;
21  import org.springframework.ws.soap.SoapMessage;
22  import org.springframework.ws.soap.addressing.core.EndpointReference;
23  import org.springframework.ws.soap.addressing.core.MessageAddressingProperties;
24  
25  /**
26   * Defines the contract for a specific version of the WS-Addressing specification.
27   *
28   * @author Arjen Poutsma
29   * @since 1.5.0
30   */
31  public interface AddressingVersion {
32  
33      /**
34       * Returns the {@link org.springframework.ws.soap.addressing.core.MessageAddressingProperties} for the given
35       * message.
36       *
37       * @param message the message to find the map for
38       * @return the message addressing properties
39       * @see <a href="http://www.w3.org/TR/ws-addr-core/#msgaddrprops">Message Addressing Properties</a>
40       */
41      MessageAddressingProperties getMessageAddressingProperties(SoapMessage message);
42  
43      /**
44       * Adds addressing SOAP headers to the given message, using the given {@link MessageAddressingProperties}.
45       *
46       * @param message the message to add the headers to
47       * @param map     the message addressing properties
48       */
49      void addAddressingHeaders(SoapMessage message, MessageAddressingProperties map);
50  
51      /**
52       * Given a <code>SoapHeaderElement</code>, return whether or not this version understands it.
53       *
54       * @param headerElement the header
55       * @return <code>true</code> if understood, <code>false</code> otherwise
56       */
57      boolean understands(SoapHeaderElement headerElement);
58  
59      /*
60       * Address URIs
61       */
62  
63      /**
64       * Indicates whether the given endpoint reference has a Anonymous address. This address is used to indicate that a
65       * message should be sent in-band.
66       *
67       * @see <a href="http://www.w3.org/TR/ws-addr-core/#formreplymsg">Formulating a Reply Message</a>
68       */
69      boolean hasAnonymousAddress(EndpointReference epr);
70  
71      /**
72       * Indicates whether the given endpoint reference has a None address. Messages to be sent to this address will not
73       * be sent.
74       *
75       * @see <a href="http://www.w3.org/TR/ws-addr-core/#sendmsgepr">Sending a Message to an EPR</a>
76       */
77      boolean hasNoneAddress(EndpointReference epr);
78  
79      /*
80       * Faults
81       */
82  
83      /**
84       * Adds a Invalid Addressing Header fault to the given message.
85       *
86       * @see <a href="http://www.w3.org/TR/ws-addr-soap/#invalidmapfault">Invalid Addressing Header</a>
87       */
88      SoapFault addInvalidAddressingHeaderFault(SoapMessage message);
89  
90      /**
91       * Adds a Message Addressing Header Required fault to the given message.
92       *
93       * @see <a href="http://www.w3.org/TR/ws-addr-soap/#missingmapfault">Message Addressing Header Required</a>
94       */
95      SoapFault addMessageAddressingHeaderRequiredFault(SoapMessage message);
96  
97  }