Camel
  1. Camel
  2. CAMEL-4351

Impossible to use placeholders in endpointName and serviceName attributes of cxf:cxfEndpoint

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.7.3
    • Fix Version/s: 2.9.0
    • Component/s: camel-cxf
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      Here is how endpointName and serviceName are declared in XSD.

      <xsd:attribute name="endpointName" type="xsd:QName" /> 
      <xsd:attribute name="serviceName" type="xsd:QName" /> 
      

      So the xml parser fails to parse the following element

      <cxf:cxfEndpoint id="service" address="${http.service.endpoint.path}" wsdlURL="${http.service.wsdl.path}"
          serviceName="${http.service.serviceName}"
          endpointName="${http.service.portName}">
      </cxf:cxfEndpoint>
      

        Issue Links

          Activity

          Hide
          Claus Ibsen added a comment -

          I assume you use Spring, and that ${ } is spring property placeholders, right?

          Show
          Claus Ibsen added a comment - I assume you use Spring, and that ${ } is spring property placeholders, right?
          Hide
          Sergey Zhemzhitsky added a comment -

          Hi Claus,

          That's right. This is spring property placeholders.

          Show
          Sergey Zhemzhitsky added a comment - Hi Claus, That's right. This is spring property placeholders.
          Hide
          Willem Jiang added a comment -

          Hi Sergey,

          I just commit a quick fix for it, you have to add a customer converter to covert the String into QName like this.

            <bean id="conversionService"
                class="org.springframework.context.support.ConversionServiceFactoryBean">
              <property name="converters">
                  <list>
                      <bean class="org.apache.camel.component.cxf.spring.QNameConverter"/>
                  </list>
              </property>
            </bean>
          
          

          Can you try it with latest camel trunk for it ?

          Willem

          Show
          Willem Jiang added a comment - Hi Sergey, I just commit a quick fix for it, you have to add a customer converter to covert the String into QName like this. <bean id= "conversionService" class= "org.springframework.context.support.ConversionServiceFactoryBean" > <property name= "converters" > <list> <bean class= "org.apache.camel.component.cxf.spring.QNameConverter" /> </list> </property> </bean> Can you try it with latest camel trunk for it ? Willem
          Hide
          Sergey Zhemzhitsky added a comment -

          Hi Willem,

          I will try it and will let you know about the results.

          Show
          Sergey Zhemzhitsky added a comment - Hi Willem, I will try it and will let you know about the results.
          Hide
          Willem Jiang added a comment -

          I just committed a new patch, you don't need to add to customer converter as I just showed now.

          Show
          Willem Jiang added a comment - I just committed a new patch, you don't need to add to customer converter as I just showed now.
          Hide
          Sergey Zhemzhitsky added a comment - - edited

          Hi Willem,

          I've just tested the new functionality and the attached patch for the CxfEndpointBeans.xml makes the test failed.

          Here is the stacktrace

          Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myEndpoint': Error setting property
          values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'endpointNameString' of bean class
           [org.apache.cxf.jaxws.JaxWsProxyFactoryBean]: Bean property 'endpointNameString' is not writable or has an invalid setter method. Does
           the parameter type of the setter match the return type of the getter?
                  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBean
          Factory.java:1361)
                  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory
          .java:1086)
                  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.configureBean(AbstractAutowireCapableBeanFactor
          y.java:314)
                  at org.springframework.beans.factory.wiring.BeanConfigurerSupport.configureBean(BeanConfigurerSupport.java:146)
                  at org.apache.cxf.configuration.spring.ConfigurerImpl.configureBean(ConfigurerImpl.java:151)
                  at org.apache.cxf.configuration.spring.ConfigurerImpl.configureBean(ConfigurerImpl.java:115)
                  at org.apache.camel.component.cxf.CxfSpringEndpoint.configure(CxfSpringEndpoint.java:225)
                  at org.apache.camel.component.cxf.CxfSpringEndpoint.createClient(CxfSpringEndpoint.java:117)
                  at org.apache.camel.component.cxf.CxfProducer.<init>(CxfProducer.java:71)
                  at org.apache.camel.component.cxf.CxfEndpoint.createProducer(CxfEndpoint.java:153)
                  at org.apache.camel.impl.ProducerCache.doGetProducer(ProducerCache.java:377)
                  ... 86 more
          Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'endpointNameString' of bean class [org.apache.cxf.
          jaxws.JaxWsProxyFactoryBean]: Bean property 'endpointNameString' is not writable or has an invalid setter method. Does the parameter ty
          pe of the setter match the return type of the getter?
                  at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:1024)
                  at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:903)
                  at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:76)
                  at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:58)
                  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBean
          Factory.java:1358)
                  ... 96 more
          

          Properties endpointNameString, serviceNameString seem to be applied to ClientProxyFactoryBean, ClientFactoryBean, ServerFactoryBean, JaxWsServerFactoryBean, and these classes don't have such properties.

          Show
          Sergey Zhemzhitsky added a comment - - edited Hi Willem, I've just tested the new functionality and the attached patch for the CxfEndpointBeans.xml makes the test failed. Here is the stacktrace Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myEndpoint': Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'endpointNameString' of bean class [org.apache.cxf.jaxws.JaxWsProxyFactoryBean]: Bean property 'endpointNameString' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBean Factory.java:1361) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory .java:1086) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.configureBean(AbstractAutowireCapableBeanFactor y.java:314) at org.springframework.beans.factory.wiring.BeanConfigurerSupport.configureBean(BeanConfigurerSupport.java:146) at org.apache.cxf.configuration.spring.ConfigurerImpl.configureBean(ConfigurerImpl.java:151) at org.apache.cxf.configuration.spring.ConfigurerImpl.configureBean(ConfigurerImpl.java:115) at org.apache.camel.component.cxf.CxfSpringEndpoint.configure(CxfSpringEndpoint.java:225) at org.apache.camel.component.cxf.CxfSpringEndpoint.createClient(CxfSpringEndpoint.java:117) at org.apache.camel.component.cxf.CxfProducer.<init>(CxfProducer.java:71) at org.apache.camel.component.cxf.CxfEndpoint.createProducer(CxfEndpoint.java:153) at org.apache.camel.impl.ProducerCache.doGetProducer(ProducerCache.java:377) ... 86 more Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'endpointNameString' of bean class [org.apache.cxf. jaxws.JaxWsProxyFactoryBean]: Bean property 'endpointNameString' is not writable or has an invalid setter method. Does the parameter ty pe of the setter match the return type of the getter? at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:1024) at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:903) at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:76) at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:58) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBean Factory.java:1358) ... 96 more Properties endpointNameString, serviceNameString seem to be applied to ClientProxyFactoryBean, ClientFactoryBean, ServerFactoryBean, JaxWsServerFactoryBean, and these classes don't have such properties.
          Hide
          Willem Jiang added a comment -

          Hi Sergey,

          I can reproduce the error, will look into it later.
          Thanks for pointing that out.

          Show
          Willem Jiang added a comment - Hi Sergey, I can reproduce the error, will look into it later. Thanks for pointing that out.
          Hide
          Willem Jiang added a comment -

          Hi Sergey,
          I just committed a quick fix for the issue that you met.
          Do you mind try it again ?

          Thanks,

          Willem

          Show
          Willem Jiang added a comment - Hi Sergey, I just committed a quick fix for the issue that you met. Do you mind try it again ? Thanks, Willem
          Hide
          Sergey Zhemzhitsky added a comment -

          Hi Willem,

          I've just tried the latest version from the trunk.
          Now everything works like a charm.
          Thank you very much for such a great help.

          Regards,
          Sergey

          Show
          Sergey Zhemzhitsky added a comment - Hi Willem, I've just tried the latest version from the trunk. Now everything works like a charm. Thank you very much for such a great help. Regards, Sergey

            People

            • Assignee:
              Willem Jiang
              Reporter:
              Sergey Zhemzhitsky
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development