Skip to content

Camel Spring-WS and AbstractAddressingEndpointMapping [SWS-817] #897

@gregturn

Description

@gregturn

Andrej Zachar opened SWS-817 and commented

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


Affects: 2.0.3

Attachments:

Referenced from: commits 1ab5148

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions