Hello,

I am fairly new to CXF and Spring, and have been tasked to port an existing
XFire Soap service to CXF.

Right now, my service seems to be correctly configured: I can access the
WSDL which seems correct (minor differences but I'll worry about that
later).

The problem I have is that some beans that were injected by spring in my
service under XFire are not injected in my CXF implementation.

My implementation class looks something like this:

@WebService(endpointInterface = "demo.cxf.ServiceCxf")
public class ServiceCxfImpl implements ServiceCxf {
    private SearchService search;
    private SearchSpec spec;
    /**
     * @inheritDoc
     */
    public SearchResult[] searchSimple(SearchSpec spec) {
        return search.searchSimple(spec);
    }

 The problem is that my SearchService bean is never instantiated.

My config:
searchService.xml
<beans xmlns="http://www.springframework.org/schema/beans";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:jaxws="http://cxf.apache.org/jaxws";
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd";>

<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
 <bean id="aegisBean"
class="org.apache.cxf.aegis.databinding.AegisDatabinding"
scope="prototype"/>
 <bean id="jaxws-and-aegis-service-factory"
    class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean"
    scope="prototype">
        <property name="dataBinding" ref="aegisBean"/>
                 <property name="serviceConfigurations">
                     <list>
                       <bean
class="org.apache.cxf.jaxws.support.JaxWsServiceConfiguration"/>
                       <bean
class="org.apache.cxf.aegis.databinding.XFireCompatibilityServiceConfiguration"/>
                       <bean
class="org.apache.cxf.service.factory.DefaultServiceConfiguration"/>
                    </list>
                 </property>
</bean>


  <bean id="searchService"
        class="demo.cxf.SearchService"/>


<jaxws:endpoint id="ServiceCxf"
   implementor=demo.cxf.ServiceCxfImpl"
   address="/searchServiceCxf">
   <jaxws:serviceFactory>
   <ref bean='jaxws-and-aegis-service-factory'/>
   <ref bean='searchService'/>
   </jaxws:serviceFactory>


</jaxws:endpoint>
</beans>

In web.xml, my servlet is simply configured like so:

 <servlet>
    <servlet-name>CXFServlet</servlet-name>
    <display-name>CXF Servlet</display-name>
    <servlet-class>
        org.apache.cxf.transport.servlet.CXFServlet
    </servlet-class>
  </servlet>

 <servlet-mapping>
    <servlet-name>CXFServlet</servlet-name>
    <url-pattern>/cxf/*</url-pattern>
  </servlet-mapping>


I have no idea why I can't inject the bean using spring. I tried lots of
different things that probably make no sense, and I am a bit lost to be
honest.
Could somebody point me in the right direction?

Thanks a lot in advance for your help.

--
Loïc Paillotin

Reply via email to