MessageContext messageContext = new MessageContext();
messageContext.setConfigurationContext(serverConfigContext);
messageContext.setAxisService(serverConfigContext.getAxisConfiguration().getService("RMSampleService"));
messageContext.setEnvelope(dummyEnvelope);
RMMsgContext applicationRMMsg = new RMMsgContext(messageContext);
// Generate the Sequence field.
// -------------------------------
String rmNamespaceValue = SpecSpecificConstants.getRMNamespaceValue(Sandesha2Constants.SPEC_VERSIONS.v1_1);
Sequence sequence = new Sequence(rmNamespaceValue);
MessageNumber msgNumber = new MessageNumber(rmNamespaceValue);
msgNumber.setMessageNumber(1);
sequence.setMessageNumber(msgNumber);
Identifier id1 = new Identifier(rmNamespaceValue);
id1.setIndentifer(uuid);
sequence.setIdentifier(id1);
applicationRMMsg.setMessagePart(Sandesha2Constants.MessageParts.SEQUENCE, sequence);
applicationRMMsg.addSOAPEnvelope();
// --------------------------------------------
// Finished generating Sequence part
// Create an RMSBean so the create sequence message can be created
messageContext.setWSAAction(pingAction);
// Set the AxisOperation to be InOut
AxisOperation operation = messageContext.getAxisService().getOperation(Sandesha2Constants.RM_IN_OUT_OPERATION);
operation.setMessageReceiver(new RMMessageReceiver());
messageContext.setAxisOperation(operation);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
// Serialize the application message
applicationRMMsg.getMessageContext().getEnvelope().serialize(outputStream);
return outputStream.toByteArray();
}