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 * Indicates whether the given {@link MessageAddressingProperties} has all required properties. 61 * 62 * @return <code>true</code> if the to and action properties have been set, and - if a reply or fault endpoint has 63 * been set - also checks for the message id 64 */ 65 boolean hasRequiredProperties(MessageAddressingProperties map); 66 67 /* 68 * Address URIs 69 */ 70 71 /** 72 * Indicates whether the given endpoint reference has a Anonymous address. This address is used to indicate that a 73 * message should be sent in-band. 74 * 75 * @see <a href="http://www.w3.org/TR/ws-addr-core/#formreplymsg">Formulating a Reply Message</a> 76 */ 77 boolean hasAnonymousAddress(EndpointReference epr); 78 79 /** 80 * Indicates whether the given endpoint reference has a None address. Messages to be sent to this address will not 81 * be sent. 82 * 83 * @see <a href="http://www.w3.org/TR/ws-addr-core/#sendmsgepr">Sending a Message to an EPR</a> 84 */ 85 boolean hasNoneAddress(EndpointReference epr); 86 87 /* 88 * Faults 89 */ 90 91 /** 92 * Adds a Invalid Addressing Header fault to the given message. 93 * 94 * @see <a href="http://www.w3.org/TR/ws-addr-soap/#invalidmapfault">Invalid Addressing Header</a> 95 */ 96 SoapFault addInvalidAddressingHeaderFault(SoapMessage message); 97 98 /** 99 * Adds a Message Addressing Header Required fault to the given message. 100 * 101 * @see <a href="http://www.w3.org/TR/ws-addr-soap/#missingmapfault">Message Addressing Header Required</a> 102 */ 103 SoapFault addMessageAddressingHeaderRequiredFault(SoapMessage message); 104 105 }