1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.springframework.ws.soap.server.endpoint.mapping;
18
19 import org.springframework.util.Assert;
20 import org.springframework.util.StringUtils;
21 import org.springframework.ws.context.MessageContext;
22 import org.springframework.ws.server.EndpointInterceptor;
23 import org.springframework.ws.server.EndpointInvocationChain;
24 import org.springframework.ws.server.endpoint.mapping.AbstractMapBasedEndpointMapping;
25 import org.springframework.ws.soap.SoapMessage;
26 import org.springframework.ws.soap.axiom.AxiomSoapMessageFactory;
27 import org.springframework.ws.soap.server.SoapEndpointInvocationChain;
28 import org.springframework.ws.soap.server.SoapEndpointMapping;
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54 @Deprecated
55 public class SoapActionEndpointMapping extends AbstractMapBasedEndpointMapping implements SoapEndpointMapping {
56
57 private String[] actorsOrRoles;
58
59 private boolean isUltimateReceiver = true;
60
61 public final void setActorOrRole(String actorOrRole) {
62 Assert.notNull(actorOrRole, "actorOrRole must not be null");
63 actorsOrRoles = new String[]{actorOrRole};
64 }
65
66 public final void setActorsOrRoles(String[] actorsOrRoles) {
67 Assert.notEmpty(actorsOrRoles, "actorsOrRoles must not be empty");
68 this.actorsOrRoles = actorsOrRoles;
69 }
70
71 public final void setUltimateReceiver(boolean ultimateReceiver) {
72 isUltimateReceiver = ultimateReceiver;
73 }
74
75
76
77
78
79
80
81
82
83
84
85 @Override
86 protected final EndpointInvocationChain createEndpointInvocationChain(MessageContext messageContext,
87 Object endpoint,
88 EndpointInterceptor[] interceptors) {
89 return new SoapEndpointInvocationChain(endpoint, interceptors, actorsOrRoles, isUltimateReceiver);
90 }
91
92 @Override
93 protected String getLookupKeyForMessage(MessageContext messageContext) throws Exception {
94 if (messageContext.getRequest() instanceof SoapMessage) {
95 SoapMessage request = (SoapMessage) messageContext.getRequest();
96 String soapAction = request.getSoapAction();
97 if (StringUtils.hasLength(soapAction) && soapAction.charAt(0) == '"' &&
98 soapAction.charAt(soapAction.length() - 1) == '"') {
99 return soapAction.substring(1, soapAction.length() - 1);
100 }
101 else {
102 return soapAction;
103 }
104 }
105 else {
106 return null;
107 }
108 }
109
110 @Override
111 protected boolean validateLookupKey(String key) {
112 return StringUtils.hasLength(key);
113 }
114 }