1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.springframework.ws.soap.server.endpoint.interceptor;
18
19 import org.springframework.util.Assert;
20 import org.springframework.util.StringUtils;
21 import org.springframework.ws.WebServiceMessage;
22 import org.springframework.ws.server.EndpointInterceptor;
23 import org.springframework.ws.soap.SoapMessage;
24
25
26
27
28
29
30
31
32 public class SoapActionSmartEndpointInterceptor extends DelegatingSmartSoapEndpointInterceptor {
33
34 private final String soapAction;
35
36 public SoapActionSmartEndpointInterceptor(EndpointInterceptor delegate, String soapAction) {
37 super(delegate);
38 Assert.hasLength(soapAction, "soapAction can not be empty");
39 this.soapAction = soapAction;
40 }
41
42 @Override
43 protected boolean shouldIntercept(WebServiceMessage request, Object endpoint) {
44 if (request instanceof SoapMessage) {
45 String soapAction = ((SoapMessage) request).getSoapAction();
46 if (StringUtils.hasLength(soapAction) && soapAction.charAt(0) == '"' &&
47 soapAction.charAt(soapAction.length() - 1) == '"') {
48 soapAction = soapAction.substring(1, soapAction.length() - 1);
49 }
50 return this.soapAction.equals(soapAction);
51 }
52 else {
53 return false;
54 }
55 }
56 }