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.
Document-Oriented Examples (aka Document-Literal)
Procedure-Oriented Examples (aka RPC-Literal)
- [Basic Procedure-oriented Example]
- [Procedure-oriented Example with Header Mapping]
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
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 = ...; SoapMarshaler marshaler = new SoapMarshaler(true);
SoapMessage soapMessage = marshaler.createReader().read(soapMessageStream);
Definition definition = ...; Port port = ...; 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());
To convert a JBI normalized message to a SOAP message, you would use the following:
NormalizedMessage normalizedMessage = ...;
Definition definition = ...; Port port = ...; SoapBindingModel binding = new SoapBindingModel(port);
SoapOperationBindingModel operation = binding.getOperation(operationName);
JBIMarshaler jbi = new JBIMarshaler();
jbi.fromNMS(soapMessage, normalizedMessage, operation.getInputBindingModel());
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.