...
It is important to note that the address that you chose for your endpoint bean must be one your servlet listens on. For instance, if my Servlet was register for "/some-services/*" but my address was "/more-services/HelloWorld", there is no way CXF could receive a request.
Create a Client
CXF includes a JaxWsProxyFactory bean which create a client for you from your service interface. You simply need to tell it what your service class is (the HelloWorld interface in this case) and the URL of your service. You can then create a client bean via the JaxWsProxyFactory bean by calling it's create() method.
Here's an example:
Wiki Markup |
---|
{snippet:id=beans|lang=xml|url=cxf/trunk/distribution/src/main/release/samples/spring_http/src/main/java/demo/spring/client/client-beans.xml?revision=HEAD} |
If you were going to access your client you could now simply pull it out of the Spring context (or better yet, inject it into your application using Spring!):
Code Block | ||||
---|---|---|---|---|
| ||||
ApplicationContext context = ...; // your Spring ApplicationContext
HellWorld client = (HelloWorld) context.getBean("client");
|
Advanced Steps
For more information on using Spring you may want to read the Configuration and Spring sections of the User's Guide.