Uploaded image for project: 'Spring Web Services'
  1. Spring Web Services
  2. SWS-817

Camel Spring-WS and AbstractAddressingEndpointMapping

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.3
    • Fix Version/s: 2.1.3
    • Component/s: Core
    • Labels:
      None

      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

        Activity

        azachar Andrej Zachar created issue -
        arjen.poutsma Arjen Poutsma made changes -
        Field Original Value New Value
        Assignee Arjen Poutsma [ arjen.poutsma ]
        arjen.poutsma Arjen Poutsma made changes -
        Fix Version/s 2.1.3 [ 13897 ]
        arjen.poutsma Arjen Poutsma made changes -
        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&#39;&#39;>
        ...
        <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
        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&#39;&#39;>
        ...
        <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 {

        .....

        {code}
         /**
             * 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;
            }

        {code}

        Thank you very much for your support and cooperation!
        Andrej
        arjen.poutsma Arjen Poutsma made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        arjen.poutsma Arjen Poutsma made changes -
        Status In Progress [ 3 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            arjen.poutsma Arjen Poutsma
            Reporter:
            azachar Andrej Zachar
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: