1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.springframework.ws.soap.addressing.version;
18
19 import java.net.URI;
20 import javax.xml.namespace.QName;
21
22 import org.springframework.util.Assert;
23 import org.springframework.ws.soap.SoapMessage;
24 import org.springframework.ws.soap.addressing.core.EndpointReference;
25 import org.springframework.ws.soap.addressing.core.MessageAddressingProperties;
26 import org.springframework.xml.namespace.QNameUtils;
27
28
29
30
31
32
33
34
35
36
37 public class Addressing10 extends AbstractAddressingVersion {
38
39 private static final String NAMESPACE_URI = "http://www.w3.org/2005/08/addressing";
40
41 @Override
42 public void addAddressingHeaders(SoapMessage message, MessageAddressingProperties map) {
43 Assert.notNull(map.getAction(), "'Action' is required");
44 super.addAddressingHeaders(message, map);
45 }
46
47 public boolean hasRequiredProperties(MessageAddressingProperties map) {
48 if (map.getAction() == null) {
49 return false;
50 }
51 if (map.getReplyTo() != null || map.getFaultTo() != null) {
52 return map.getMessageId() != null;
53 }
54 return true;
55
56 }
57
58 @Override
59 protected String getNamespaceUri() {
60 return NAMESPACE_URI;
61 }
62
63 @Override
64 protected QName getReferencePropertiesName() {
65 return null;
66 }
67
68 @Override
69 protected URI getDefaultTo() {
70 return getAnonymous();
71 }
72
73 @Override
74 protected EndpointReference getDefaultReplyTo(EndpointReference from) {
75 return new EndpointReference(getAnonymous());
76 }
77
78 @Override
79 protected final URI getAnonymous() {
80 return URI.create(NAMESPACE_URI + "/anonymous");
81 }
82
83 @Override
84 protected final URI getNone() {
85 return URI.create(NAMESPACE_URI + "/none");
86 }
87
88 @Override
89 protected final QName getMessageAddressingHeaderRequiredFaultSubcode() {
90 return QNameUtils.createQName(NAMESPACE_URI, "MessageAddressingHeaderRequired", getNamespacePrefix());
91 }
92
93 @Override
94 protected final String getMessageAddressingHeaderRequiredFaultReason() {
95 return "A required header representing a Message Addressing Property is not present";
96 }
97
98 @Override
99 protected QName getInvalidAddressingHeaderFaultSubcode() {
100 return QNameUtils.createQName(NAMESPACE_URI, "InvalidAddressingHeader", getNamespacePrefix());
101 }
102
103 @Override
104 protected String getInvalidAddressingHeaderFaultReason() {
105 return "A header representing a Message Addressing Property is not valid and the message cannot be processed";
106 }
107
108 public String toString() {
109 return "WS-Addressing 1.0";
110 }
111 }