How do I
kw_richards Jan 7, 2009 12:50 PMHi,
Please help, I'm sure I'm missing something simple (or misunderstanding something) but I just can't seem to enable CXF.
I started by developing a "normal" (JSR181 annotated web service)
My java class
@WebService @SOAPBinding ( style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.WRAPPED ) public class EntryPointWs { @WebMethod public String sendMessage( @WebParam(name = "message") String message ) { return "Hello " + message; } }
and my web.xml
<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"> <servlet> <servlet-name>EntryPointWs</servlet-name> <servlet-class>za.co.poc.comm.EsbEntryPointWs</servlet-class> </servlet> <servlet-mapping> <servlet-name>EntryPointWs</servlet-name> <url-pattern>/EntryPointWs</url-pattern> </servlet-mapping> </web-app>
This works fine.
My question is how do I enable CXF?
If I look at http://jbossws.jboss.org/mediawiki/index.php?title=Stack_CXF_User_Guide
It seems I only need to add jbossws-cxf.xml to my WEB-INF directory
(my jbossws-cxf.xml)
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns='http://www.springframework.org/schema/beans' xmlns:jaxws='http://cxf.apache.org/jaxws' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:wsa="http://cxf.apache.org/ws/addressing" 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 '> <!-- Load CXF modules from cxf.jar --> <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" /> <jaxws:endpoint id='ServiceImpl' address='http://localhost:9080/jaxws-samples-wsa' implementor='za.co.poc.comm.EsbEntryPointWs'> <jaxws:invoker> <bean class='org.jboss.wsf.stack.cxf.InvokerJSE'/> </jaxws:invoker> </jaxws:endpoint> </beans>
However, I have reason to believe it is actually not doing anything for 2 reasons.
1. If I use my browser to browse to "http://localhost:9080/jaxws-samples-wsa" (as defined in the endpoint) I get an error
saying nothing is listening on port 9080.
2. If I make a "mistake" in the above file (e.g. make the last "tag" "bean" instead of "/beans") I do not get notified
of any issue.
I realise I'm doing something obviously wrong, but if someone can just point me in the right direction,
it would be greatly appreciated.
PS. I assume the CXF stack is running since I'm getting the following in the JBoss log when it starts up
19:46:46,859 INFO [CXFServerConfig] JBoss Web Services - Stack CXF Runtime Server 19:46:46,859 INFO [CXFServerConfig] 3.0.5.GA 19:46:51,593 INFO [Embedded] Catalina naming disabled 19:46:51,906 INFO [AprLifecycleListener] The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre1.5.0_06\bin;.;C:\WINDOWS\system32;C:\WINDOWS;native 19:46:52,031 INFO [Http11Protocol] Initializing Coyote HTTP/1.1 on http-localhost%2F127.0.0.1-8080 19:46:52,031 INFO [AjpProtocol] Initializing Coyote AJP/1.3 on ajp-localhost%2F127.0.0.1-8009 19:46:52,031 INFO [Catalina] Initialization processed in 441 ms 19:46:52,031 INFO [StandardService] Starting service jboss.web 19:46:52,046 INFO [StandardEngine] Starting Servlet Engine: JBossWeb/2.0.1.GA 19:46:52,375 INFO [Catalina] Server startup in 330 ms