This example shows you how to create a new ServiceMessageObject
object inside a Custom Mediation primitive.
Context
The following code sample shows you how to
create a new ServiceMessageObject object inside a Custom Mediation primitive.
The Custom Mediation primitive is used to replace the incoming DataObject
object.
Requirements
You must know how to set up a mediation
flow with a Custom Mediation primitive.
Java imports
import javax.xml.namespace.QName;
import com.ibm.websphere.sibx.smobo.ServiceMessageObject;
import com.ibm.websphere.sibx.smobo.ServiceMessageObjectFactory;
Code sample
.
.
.
QName qName = new QName("http://Examples/Interface", "Operation1RequestMsg");
ServiceMessageObjectFactory smoFactory = ServiceMessageObjectFactory.eINSTANCE;
ServiceMessageObject smo = smoFactory.createServiceMessageObject(qName);
This
code sample creates a new ServiceMessageObject object with empty headers and
a business object for the body. An exception occurs if the code sample fails.
Further information
The Custom Mediation primitive
can output a different ServiceMessageObject object. For example, a value in
the input ServiceMessageObject object indicates that a different ServiceMessageObject
object should be returned.
To create the QName object, the user must import javax.xml.namespace.QName.
The new QName object must have two arguments, which can be found in the interface
WSDL file. The first is the namespace URI, which is the value for xmlns:tns in
the wsdl:definitions line. The second is either the input
or the output, which is the value for the message in the wsdl:input or wsdl:output.