John Smith
John Smith

Reputation: 97

How create & publish a WebService using Camel?

Is it possible to create and publish a WebService using camel without the need of xml files?

With JAX-WS I can create a WS like

@WebService
@SOAPBinding(style = Style.RPC)
public class CreatorWebService {

public String create(String word1, String word2, String word3) {
return Maker.make(word1, word2, word3);
}}

and publish it very easy with

public static void main(String args[]) {
    CreatorWebService server = new CreatorWebService ();
    Endpoint endpoint = Endpoint.publish("http://localhost:8080/creator", server);
}

How can this be done with camel and if possible with JAVA DSL and without using XML (web.xml, beans...)?

I want to use the incoming messages of this WS as input for a route like for example:

from(WSinputMessage).to("myProcessor").to(doSomething); 

Any help would be very much appreciated.

Upvotes: 1

Views: 851

Answers (1)

Petter Nordlander
Petter Nordlander

Reputation: 22279

I'm not really sure how you want the WS request to be parsed and how you should treat it, since there might be several ways.

Should be possible to achive a very similar setup with Camel using the jetty component and the CXF BEAN component

i.e.

 from("jetty:http://localhost:9000/").to("cxfbean:serviceObj").to("handleReplySomehow");
     //serviceObj does not have to be a spring bean, but can be a JAX-WS annotated object in the camel registry.

Upvotes: 1

Related Questions