Best way to implement ebXml/ebMs with apache camel

1k Views Asked by At

First of all, I haven't found any generic open source implementation for ebxml/ebms, for me it's somehow strange or maybe I have looked up the wrong stuff, but I haven't found here something rly usefull.

When I was looking for ebxml/ebms I have also found JAXM/SAAJ(JSR 67). It looks like this implementations never got to an end, all links regarding this are refering to the sun homepage which doesn't exist anymore. From the sun homepage you get redirected to the oracle homepage, and there I can't find something about JAXM or JSR 67.

This leads me to my question, how to implement an ebxml service in apache camel?

  1. Should I create the ebxml SOAP message "manually" or are there some libs I've missed that are generating such an ebxml message for me?`
  2. How to send such an ebXml SOAP message via apache camel? Cxf needs an wsdl, for the service we want to call there exists no wsdl.
  3. How to recieve such ebXml messages? Cxf see above, maybe with an http consumer like netty-http or jetty?
2

There are 2 best solutions below

0
On

A few years too late, but maybe valuable for others :)

There is an open source implementation available which supports the ebMS 2.0 spec. This ebMS adapter can be deployed as a Mule ESB plugin or as a regular WAR application.

https://sourceforge.net/projects/muleebmsadapter/

Despite being on sourceforge, it is still being actively developed.

1
On
  1. You can use velocity template to create the ebxml SOAP message manually, for example.

Template example:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
               xmlns:ser="http://test/Service">
   <soap:Header/>
   <soap:Body>
      <ser:insertRequest>
         <ser:routingHeader>
            <ser:operationType>${headers.OPERATION_TYPE}</ser:operationType>
            <ser:messageId>${exchange.properties.messageId}</ser:messageId>
            <ser:sourceId>${exchange.properties.sourceId}</ser:sourceId>
            <ser:destinationId>${exchange.properties.destinationId}</ser:destinationId>
         </ser:routingHeader>
         <ser:datagram>
            ${body}
         </ser:datagram>
      </ser:insertRequest>
   </soap:Body>
</soap:Envelope>
  1. You can use http, http4 or jetty components to send such an ebXml SOAP message via apache camel.

            to("jetty:http://{{server.host}}:{{server.http.port}}/service/").
            log(LoggingLevel.INFO, "HTTP response code: ${in.header.CamelHttpResponseCode}")
    
  2. After you only need to parse SOAP response manually (XPath, maybe), or you can transform response by XSLT. Maybe you can use beanio, xstream or jaxb and so on to transform XML to POJO.


    ....
        to("velocity:file:///{{karaf.home}}/etc/vm/ws-message-oc.vm?contentCache=true").                                
    setProperty(Exchange.CONTENT_TYPE).constant("application/soap+xml").
        setProperty(Exchange.CONTENT_ENCODING).constant("gzip").
        setProperty(Exchange.CHARSET_NAME).constant("utf-8").
        //log(LoggingLevel.INFO, "WS request: ${body}").
        to("jetty:http://{{app-server.host}}:{{app-server.http.port}}/service/").
        log(LoggingLevel.INFO, "HTTP response code: ${in.header.CamelHttpResponseCode}")
        //log(LoggingLevel.INFO, "WS response: ${body}")
        .setHeader("callRC").xpath("//ser:callRC/text()", String.class, XmlNamespaces.NAMESPACES.getNamespace())
    ....