0

I am really getting stuck on how to integrate my business applications to Fuse ESB. In particular - web services functionality. I have a couple of questions -

1) Can I 'wrap' a blueprint.xml in Fuse ESB as a web service and call it from a business application?

2) How can I expose existing functionality as web services and call them, using Fuse ESB?

Thanks to anyone with Fuse knowledge who may be able to help me!

Tv_
  • 163
  • 1
  • 3
user1769045
  • 141
  • 1
  • 3
  • 12

1 Answers1

2

Well, here is one way to do it. It may not be the best approach (comments welcome...) but here it is in any case.

You obviously have the wsdl for your web service, and the code that does the business logic.

  1. Create a maven module for your web service using cxf-codegen-plugin (for generated-sources) and maven-bundle-plugin (for bundle config and OSGI wiring)

  2. In your blueprint.xml define your <camel-cxf:cxfEndpoint id="abc" ... where serviceClass is your generated endpoint interface class.

  3. Define a <camel:camelContext id="abc" ...> with a <camel:routeBuilder ref="xyz"/> referring to a bean you define that extends RouteBuilder.

  4. Now we work in the class that extends RouteBuilder. The configure() method should then set up camel routes corresponding to each of the operations in your web service. Use the java fluent builder syntax.

Here's an example of the fluent builder syntax:

    from("direct:myOperation")
            .routeId("myOperation")
            .onException(SomeException.class).doSomething().doSomethingElse();
            .validate(/* an expression */)
            .beanRef("myBusinessLogicBean", "someMethod")
            .convertBodyTo(MyResult.class)

Basically, we have taken the routing layer and re-written it as a camel route, and the business logic is called via beanRef - where the bean, and it's dependencies (such as datasources / dao's or persistence.xml) are configured in blueprint.xml.

There are some really nice things you can do in the fluent builder syntax - just google camel cxf and browse through the many examples. You also have access to all the EIPs (enterprise integration patterns).

The last thing you have to do is define a feature.xml which uses the <bundle> and defines the correct <feature> dependencies (e.g. camel-cxf, camel-jpa, etc).

I hope this helps to get you started.

vikingsteve
  • 38,481
  • 23
  • 112
  • 156