Hello CXF users and developers.
I would like create some module web application with web services. When I
use Spring's DisplatcherServlet everything works fine, but CXFServlet
doesn't see jaxws:endpoint defined in imported context.
Code snippets.
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="webapp" version="2.5"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="
http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/security.xml <!-- spring security configuratio -->
/WEB-INF/applicationContext.xml <!-- DAOs etc -->
<!-- classpath:/module/**-context.xml-->
</param-value>
</context-param>
<servlet>
<servlet-name>main</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>main</servlet-name>
<url-pattern>*.form</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>CXFServlet</servlet-name>
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
<init-param>
<param-name>hide-service-list-page</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>base-address</param-name>
<param-value>services</param-value>
</init-param>
<init-param>
<param-name>config-location</param-name>
<param-value>/WEB-INF/cxf-servlet.xml</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
</web-app>
cxf-servlet.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cxf="http://cxf.apache.org/core"
xmlns:simple="http://cxf.apache.org/simple"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="
http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
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 at the end also doesn't works -->
<import resource="classpath:/module/**-context.xml" />
<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-extension-http-binding.xml"/>
<import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
<bean id="logOutbound"
class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
<!-- cxf:bus also doesn't works -->
<bean id="cxf" class="org.apache.cxf.bus.CXFBusImpl">
<property name="inInterceptors">
<list>
<ref bean="logOutbound" />
</list>
</property>
<property name="outInterceptors">
<list>
<ref bean="logOutbound" />
</list>
</property>
<property name="outFaultInterceptors">
<list>
<ref bean="logOutbound" />
</list>
</property>
</bean>
</beans>
Sampel module (contribution-context.xml):
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:cxf="http://cxf.apache.org/core"
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
">
<bean id="contributionModule"
class="pl.bpsa.sw.modules.contribution.ContributionModule" />
<jaxws:endpoint id="contribution" address="contribution"
implementor="pl.bpsa.sw.modules.contribution.ContributionTypeImpl">
</jaxws:endpoint>
</beans>
The ContributionModule implements InitializingBean and its correctly created
but CXF doesn't see endpoint.
My Maven structure:
parent
`-- webapp (web context, forms etc)
`-- modules (web services implementation)
`-- contribution
`-- scoring
The Webapp have dependencies to CXF:
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-bindings-http</artifactId>
<version>2.1.1</version>
</dependency>
Modules have the same dependencies but it's scope was set to provided.
If I copy endpoint configuration from module to applicationContext.xml in
webapp CXF will publish web service. What should I do to use dispersed
configuration with CXF?
Regards,
Luke
--
View this message in context:
http://www.nabble.com/JAX-WS---multiple-services-in-separate-jars-tp18336903p18336903.html
Sent from the cxf-user mailing list archive at Nabble.com.