Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
xml
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-2.0.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schema/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"/>
  
  <jaxws:endpoint id="greeter" 
                  implementor="org.apache.hello_world_soap_http.GreeterImpl"
                  address="http://localhost/services/Greeter1"/>
</beans>

Here we're creating a JAX-WS endpoint based on our implementation class, GreeterImpl. We're publishing this class at the address "http://localhost/services/Greeter1". Since Servlets are not aware of their HTTP address, the Servlet will listen for requests on all available hosts/ports that it has been set up to listen on by its container.

...

Once your Servlet is registered in your web.xml, you should not have to do anything special to make sure that CXF uses it as it's HTTP Transport. Simply publish to with the host related path "localhostGerreter" and your service should appear at the address you specify:

Code Block
java
java
Endpoint.createpublish("http://localhost/services/Greeter", new GreeterImpl());

...