3 Replies Latest reply on Jan 11, 2011 8:33 PM by ffang

    Placeholder for "service" attribute in cxfbc provider

    aweinstein

       

      I am trying in ESB 4.2 to create cxfbc provider endpoints (see example below) with property placeholders (via PropertyPlaceholderConfigurer) for some of the attributes I want to define externally. This works fine except for the service attribute with is a QName and not a String. Whatever I put in that field is interpreted literally and an exception is thrown stating it's not a valid QName. Is there any other way to define this attribute externally?

       

      <cxfbc:provider

      endpoint="${...}" locationURI="${...}"

      service="$" useJBIWrapper="false"

      wsdl="classpath:${...}"/>;

       

      One thing I had tried is creating a QName bean and referencing the bean in the service field as below:

       

      <bean id="theService" class="javax.xml.namespace.QName">

      <constructor-arg index="0" value="${eram.ns}"/>;

      <constructor-arg index="1" value="${eram.name}"/>;

      </bean>

       

      <cxfbc:provider

      endpoint="${...}" locationURI="${...}"

      service="#theService" useJBIWrapper="false"

      wsdl="classpath:${...}"/>

       

       

      This doesn't work either.  The value is still interpreted literally and an exception is thrown.

       

      Any help would be appreciated.

       

       

       

      Thanks,

       

       

      Adam

       

       

        • 1. Re: Placeholder for "service" attribute in cxfbc provider
          ffang

          Hi,

           

          Define property placeholder in the javax.xml.namespace.QName bean way should work.

          You should use OSGi style property placeholder which we demostrated in camel-osgi example shipped with kit.

           

           

          Freeman

          • 2. Re: Placeholder for "service" attribute in cxfbc provider
            aweinstein

            I tried the OSGI style property placeholder, but this does not resolve the original issue.

            Putting #theService in the service field does not get resolved to the QName bean by that name.  It is interpreted literally and an exception is thrown complaining that #theService is not a valid value for QName.

             

            Another approach I tried was to create the CxfBcProviders in a java class and just create an instance of that class as a spring bean.  However, an exception is thrown when it tries to activate a provider (see excerpt below).

             

            java.lang.NullPointerException

                    at org.apache.servicemix.common.EndpointComponentContext.(EramCxfBcProviderBuilder.java:51)

             

            Below is the code I am using to create each endpoint.  Apparently I am missing some important piece(s).  Is there a good example somewhere of how to do this?

             

            CxfBcProvider provider = new CxfBcProvider();

            provider.setWsdl(wsdl);

            provider.setService(service);

            provider.setEndpoint(endpoint);

            provider.setLocationURI(urlValue);

            provider.setUseJBIWrapper(false);

            provider.activate();

             

             

            Any help would be appreciated.

             

            Thanks,

            Adam

            • 3. Re: Placeholder for "service" attribute in cxfbc provider
              ffang

              Hi,

               

              You're using JBI packaging or OSGi packaging?

               

              Is it possible that  you append a buildable testcase with spring QName bean injection?

              I'll take a look when I get chance.

               

              Freeman