Dashboard > PXE > Home2 > SOAP Binding and JBI Normalization > View

Page Operations


Navigation


PXE Log In   View a printable version of the current page.
SOAP Binding and JBI Normalization
Added by Alex Boisvert, last edited by Alex Boisvert on Aug 31, 2006

Introduction

This section reviews the normalization aspects of SOAP messages into JBI messages.

A patch was recently submitted to the Apache ServiceMix project to support message normalization with the servicemix-http component. The patch also provides a set of utility classes to perform JBI message normalization to/from SOAP 1.1 message.

Examples

Document-Oriented Examples (aka Document-Literal)

Procedure-Oriented Examples (aka RPC-Literal)

  • [Basic Procedure-oriented Example]
  • [Procedure-oriented Example with Header Mapping]

Configuring Ode

To process normalized messages, the Ode service engine must be configured with the ode-jbi.messageMapper property set to the value org.apache.ode.jbi.msgmap.JbiWsdl11WrapperMapper.

This property is configured in the ode-jbi.properties file which is deployed in the ode-jbi-install-2.X-SNAPSHOT.zip service assembly.

# Class name of the message mapper that should be used to convert message
# between ODE / NMS.
# org.apache.ode.jbi.msgmap.JbiWsdl11WrapperMapper - use JBI WSDL 1.1 "wrapper"
# org.apache.ode.jbi.msgmap.ServiceMixMapper
# org.apache.ode.jbi.msgmap.DocLitMapper
ode-jbi.messageMapper=org.apache.ode.jbi.msgmap.JbiWsdl11WrapperMapper

Programming with the servicemix-soap library

Here is a code snippet illustrating the conversion of a SOAP message into a JBI normalized message:

import javax.jbi.messaging.NormalizedMessage;

import org.apache.servicemix.jbi.messaging.NormalizedMessageImpl;
import org.apache.servicemix.soap.model.SoapBindingModel;
import org.apache.servicemix.soap.model.SoapOperationBindingModel;

...
...

InputStream soapMessageStream = ...; // SOAP message
SoapMarshaler marshaler = new SoapMarshaler(true);
SoapMessage soapMessage = marshaler.createReader().read(soapMessageStream);

Definition definition = ...;  // WSDL definition
Port port = ...; // extract Port from WSDL definition
SoapBindingModel binding = new SoapBindingModel(port);

String soapAction = "...";
QName bodyName = soapMessage.getBodyName();
SoapOperationBindingModel operation = binding.findOperationBindingModel(soapAction, bodyName);

JBIMarshaler jbi = new JBIMarshaler();
NormalizedMessage normalizedMessage = new NormalizedMessageImpl();
jbi.toNMS(normalizedMessage, soapMessage, operation.getInputBindingModel());

// "normalizeMessage" is ready to be sent on JBI bus

To convert a JBI normalized message to a SOAP message, you would use the following:

NormalizedMessage normalizedMessage = ...;

Definition definition = ...;  // WSDL definition
Port port = ...; // extract Port from WSDL definition
SoapBindingModel binding = new SoapBindingModel(port);

SoapOperationBindingModel operation = binding.getOperation(operationName);

JBIMarshaler jbi = new JBIMarshaler();
jbi.fromNMS(soapMessage, normalizedMessage, operation.getInputBindingModel());

References

WSDL 1.1 describes services as a set of endpoints operating on messages containing either document-oriented (DOC) or procedure-oriented (RPC) information. The operations and messages are described abstractly, and then bound to a concrete network protocol and message format to define an endpoint.

SOAP 1.1 offers both concrete protocol and message format when used together with the HTTP transport protocol.

JBI makes extensive use of WSDL's abstract message model. The JBI bus can be thought of as an abstract WSDL-defined messaging system infrastructure, where bindings and engines serve to provide and consume WSDL-defined services, and all message exchanges happen through a normalized message router.

Please refer to the WS-I Basic Profile 1.1 for information about interoperability rules regarding the use of WSDL 1.1 and SOAP 1.1.



Site powered by a free Open Source Project / Non-profit License (more) of Confluence - the Enterprise wiki.
Learn more or evaluate Confluence for your organisation.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 1.4.1 Build:#212 Jun 02, 2005) - Bug/feature request - Contact Administrators