[SWS-817] Camel Spring-WS and AbstractAddressingEndpointMapping Created: 05/Dec/12  Updated: 09/Apr/13  Resolved: 09/Apr/13

Status: Resolved
Project: Spring Web Services
Component/s: Core
Affects Version/s: 2.0.3
Fix Version/s: 2.1.3

Type: Bug Priority: Major
Reporter: Andrej Zachar Assignee: Arjen Poutsma
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Text File AbstractAddressingEndpointMapping.java.patch    

 Description   

Beste Arjen!

I am developing Camel support for Spring-WS, currently I am working on WS-Addressing issues. Could you help me please?

Imagine I would like to specify the camel configuration like this:

<camelContext>
<from uri="spring-ws:action:http://consumerOfwsaActionWithReplyTo.com?messageSender=#myCustomBean&endpointMapping=WSACamelSpringWSEndpoint''>
...
<camelContext>

The camel endpoint (WSACamelSpringWSEndpoint) that implements SoapEndpointMapping inherits from the AbstractAddressingEndpointMapping, but in order to provide custom messageSenders from the camel uri as you see above I need to change the method AbstractAddressingEndpointMapping#getEndpointInvocationChain so I can supply my message sender.

So, is it possible to create at least method called getMessageSender(Object endpoint) so I can easily hook different endpoint's message senders? E.g. here is the code with the appropriated changes marked bold:

public abstract class AbstractAddressingEndpointMappingHacked extends TransformerObjectSupport
implements SoapEndpointMapping, InitializingBean, Ordered {

.....

 /**
     * Creates a {@link SoapEndpointInvocationChain} based on the given endpoint and {@link
     * org.springframework.ws.soap.addressing.version.AddressingVersion}.
     */
    protected EndpointInvocationChain getEndpointInvocationChain(Object endpoint,
                                                               AddressingVersion version,
                                                               MessageAddressingProperties requestMap) {
        URI responseAction = getResponseAction(endpoint, requestMap);
        URI faultAction = getFaultAction(endpoint, requestMap);
        
        WebServiceMessageSender[] messageSenders = getMessageSenders(endpoint);
        MessageIdStrategy messageIdStrategy = getMessageStrategy(endpoint);
 
        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, faultAction);
        interceptors[preInterceptors.length] = interceptor;
        System.arraycopy(postInterceptors, 0, interceptors, preInterceptors.length + 1, postInterceptors.length);
        return new SoapEndpointInvocationChain(endpoint, interceptors, actorsOrRoles, isUltimateReceiver);
    }
    
    /**
     * Default implementation
     * @param endpoint specific message strategy
     * @return
     */
    protected MessageIdStrategy getMessageStrategy(Object endpoint) {
       return this.messageIdStrategy;
    }
 
    /**
     * Default implementation
     * @param endpoint
     * @return endpoint specific message senders
     */
    protected WebServiceMessageSender[] getMessageSenders(Object endpoint) {
       return this.messageSenders;
    }
    
    public final WebServiceMessageSender[] getMessageSenders() {
        return this.messageSenders;
    }
 

Thank you very much for your support and cooperation!
Andrej



 Comments   
Comment by Arjen Poutsma [ 09/Apr/13 ]

Fixed. Thanks for the patch!

Generated at Thu Dec 14 04:08:33 UTC 2017 using JIRA 6.4.14#64029-sha1:ae256fe0fbb912241490ff1cecfb323ea0905ca5.