SWS-385
This commit is contained in:
@@ -31,7 +31,8 @@ import org.springframework.ws.soap.addressing.core.MessageAddressingProperties;
|
||||
* implementations. Provides infrastructure for mapping endpoints to actions.
|
||||
* <p/>
|
||||
* By default, this mapping creates a <code>Action</code> for reply messages based on the request message, plus the
|
||||
* extra {@link #setOutputActionSuffix(String) suffix}.
|
||||
* extra {@link #setOutputActionSuffix(String) suffix}, and a * By default, this mapping creates a <code>Action</code>
|
||||
* for reply messages based on the request message, plus the extra {@link #setOutputActionSuffix(String) suffix}.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @since 1.5.0
|
||||
@@ -39,26 +40,51 @@ import org.springframework.ws.soap.addressing.core.MessageAddressingProperties;
|
||||
public abstract class AbstractActionEndpointMapping extends AbstractAddressingEndpointMapping
|
||||
implements ApplicationContextAware {
|
||||
|
||||
/** The defaults suffix to add to request <code>Action</code> for reply messages. */
|
||||
/** The defaults suffix to add to the request <code>Action</code> for reply messages. */
|
||||
public static final String DEFAULT_OUTPUT_ACTION_SUFFIX = "Response";
|
||||
|
||||
/** The defaults suffix to add to response <code>Action</code> for reply messages. */
|
||||
public static final String DEFAULT_FAULT_ACTION_SUFFIX = "Fault";
|
||||
|
||||
// keys are action URIs, values are endpoints
|
||||
private final Map endpointMap = new HashMap();
|
||||
|
||||
private String outputActionSuffix = DEFAULT_OUTPUT_ACTION_SUFFIX;
|
||||
|
||||
private String faultActionSuffix = DEFAULT_OUTPUT_ACTION_SUFFIX;
|
||||
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
/** Returns the suffix to add to request <code>Action</code>s for reply messages. */
|
||||
public String getOutputActionSuffix() {
|
||||
return outputActionSuffix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the suffix to add to request <code>Action</code>s for reply messages.
|
||||
*
|
||||
* @see #DEFAULT_OUTPUT_ACTION_SUFFIX
|
||||
*/
|
||||
public void setOutputActionSuffix(String outputActionSuffix) {
|
||||
Assert.hasText(outputActionSuffix, "'replyActionSuffix' must not be empty");
|
||||
Assert.hasText(outputActionSuffix, "'outputActionSuffix' must not be empty");
|
||||
this.outputActionSuffix = outputActionSuffix;
|
||||
}
|
||||
|
||||
/** Returns the suffix to add to request <code>Action</code>s for reply fault messages. */
|
||||
public String getFaultActionSuffix() {
|
||||
return faultActionSuffix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the suffix to add to request <code>Action</code>s for reply fault messages.
|
||||
*
|
||||
* @see #DEFAULT_FAULT_ACTION_SUFFIX
|
||||
*/
|
||||
public void setFaultActionSuffix(String faultActionSuffix) {
|
||||
Assert.hasText(faultActionSuffix, "'faultActionSuffix' must not be empty");
|
||||
this.faultActionSuffix = faultActionSuffix;
|
||||
}
|
||||
|
||||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
||||
this.applicationContext = applicationContext;
|
||||
}
|
||||
@@ -137,10 +163,21 @@ public abstract class AbstractActionEndpointMapping extends AbstractAddressingEn
|
||||
protected URI getResponseAction(Object endpoint, MessageAddressingProperties requestMap) {
|
||||
URI requestAction = requestMap.getAction();
|
||||
if (requestAction != null) {
|
||||
return URI.create(requestAction.toString() + outputActionSuffix);
|
||||
return URI.create(requestAction.toString() + getOutputActionSuffix());
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected URI getFaultAction(Object endpoint, MessageAddressingProperties requestMap) {
|
||||
URI requestAction = requestMap.getAction();
|
||||
if (requestAction != null) {
|
||||
return URI.create(requestAction.toString() + getFaultActionSuffix());
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -198,11 +198,12 @@ public abstract class AbstractAddressingEndpointMapping extends TransformerObjec
|
||||
AddressingVersion version,
|
||||
MessageAddressingProperties requestMap) {
|
||||
URI responseAction = getResponseAction(endpoint, requestMap);
|
||||
URI faultAction = getFaultAction(endpoint, requestMap);
|
||||
EndpointInterceptor[] interceptors =
|
||||
new EndpointInterceptor[preInterceptors.length + postInterceptors.length + 1];
|
||||
System.arraycopy(preInterceptors, 0, interceptors, 0, preInterceptors.length);
|
||||
AddressingEndpointInterceptor interceptor =
|
||||
new AddressingEndpointInterceptor(version, messageIdStrategy, messageSenders, responseAction, null);
|
||||
AddressingEndpointInterceptor interceptor = new AddressingEndpointInterceptor(version, messageIdStrategy,
|
||||
messageSenders, responseAction, faultAction);
|
||||
interceptors[preInterceptors.length] = interceptor;
|
||||
System.arraycopy(postInterceptors, 0, interceptors, preInterceptors.length + 1, postInterceptors.length);
|
||||
return new SoapEndpointInvocationChain(endpoint, interceptors, actorsOrRoles, isUltimateReceiver);
|
||||
@@ -230,6 +231,24 @@ public abstract class AbstractAddressingEndpointMapping extends TransformerObjec
|
||||
*/
|
||||
protected abstract Object getEndpointInternal(MessageAddressingProperties map);
|
||||
|
||||
/**
|
||||
* Provides the WS-Addressing Action for response messages, given the endpoint, and request Message Addressing
|
||||
* Properties.
|
||||
*
|
||||
* @param endpoint the mapped endpoint
|
||||
* @param requestMap the MAP for the request
|
||||
* @return the response Action
|
||||
*/
|
||||
protected abstract URI getResponseAction(Object endpoint, MessageAddressingProperties requestMap);
|
||||
|
||||
/**
|
||||
* Provides the WS-Addressing Action for response fault messages, given the endpoint, and request Message Addressing
|
||||
* Properties.
|
||||
*
|
||||
* @param endpoint the mapped endpoint
|
||||
* @param requestMap the MAP for the request
|
||||
* @return the response Action
|
||||
*/
|
||||
protected abstract URI getFaultAction(Object endpoint, MessageAddressingProperties requestMap);
|
||||
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ class AddressingEndpointInterceptor implements SoapEndpointInterceptor {
|
||||
}
|
||||
SoapMessage reply = (SoapMessage) messageContext.getResponse();
|
||||
URI replyMessageId = getMessageId(reply);
|
||||
URI action = !isFault ? replyAction : faultAction;
|
||||
URI action = isFault ? faultAction : replyAction;
|
||||
MessageAddressingProperties replyMap = requestMap.getReplyProperties(replyEpr, action, replyMessageId);
|
||||
version.addAddressingHeaders(reply, replyMap);
|
||||
if (handleAnonymousAddress(messageContext, replyEpr)) {
|
||||
|
||||
Reference in New Issue
Block a user