You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "C 4.5" <cf...@gmail.com> on 2008/06/20 00:02:11 UTC

Problem integrating CXF with Spring

I am trying to expose a service using CXF and Spring.

I think I am following what is described at:
http://cwiki.apache.org/CXF20DOC/writing-a-service-with-spring.html

Below I am attaching the source code for the interface and it's
implementation, and the configuration infomration for Spring.

I am using CXF version 2.1.1. Spring 2.

When I start the servlet insider the jetty server, all seems OK. I have
turned on debugging and don't seem to see anything unusual.

- However, I don't see any log information about the creation of the service
end point in the server logs.

- I query the server to retrieve the WSDL of the service and don't get
anything back.

 curl http://localhost/<name <http://localhost/%3Cname> of war
container>/impl?wsdl

- Is the implementation of the service correct? Is there a way I can make
sure the service is running? From the observations above (no info in the
logs and failing to get the wsdl back), i am not sure this is working
properly.

Thanks.
C4.5


=== Interface ===

package com.myprj.system;

@WebService
public interface IService {
    String getName();
}

=== Impl ===

package com.myprj.impl;

@WebService(endpointInterface = "com.myprj.system.IService")
public final class SerivceImpl implements IService,
        InitializingBean, BeanNameAware {

    ...

    public String getOptimizerName() {
        return "Test";
    }

}

This is the configuration portion:

=== web.xml ===

<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
  version="2.4">

  <display-name>Test</display-name>
  <description>Test</description>

   <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>
      classpath:applicationContext-conf.xml
    </param-value>
  </context-param>

  <listener>
    <listener-class>
      org.springframework.web.context.ContextLoaderListener
    </listener-class>
  </listener>

  <servlet>
    <servlet-name>remoting</servlet-name>

<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>

  <servlet-mapping>
    <servlet-name>remoting</servlet-name>
    <url-pattern>/*</url-pattern>
  </servlet-mapping>

</web-app>


=== remoting servlet ===
<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-2.0.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 name="myservice" class="com.myprj.impl.SerivceImpl">
    <property name="..." value="..." />
  </bean>

  <jaxws:endpoint id="MYIMPL" implementor="#myservice" address="/impl" />

</beans>