*/
public static void terminateSequence(ServiceClient serviceClient) throws SandeshaException {
setUpServiceClientAnonymousOperations (serviceClient);
ServiceContext serviceContext = serviceClient.getServiceContext();
if (serviceContext == null)
throw new SandeshaException(SandeshaMessageHelper.getMessage(
SandeshaMessageKeys.serviceContextNotSet));
Options options = serviceClient.getOptions();
if (options == null)
throw new SandeshaException(SandeshaMessageHelper.getMessage(
SandeshaMessageKeys.optionsObjectNotSet));
String rmSpecVersion = (String) options.getProperty(SandeshaClientConstants.RM_SPEC_VERSION);
if (rmSpecVersion == null)
rmSpecVersion = SpecSpecificConstants.getDefaultSpecVersion();
String rmNamespaceValue = SpecSpecificConstants.getRMNamespaceValue(rmSpecVersion);
String oldAction = options.getAction();
//in WSRM 1.0 we are adding another application msg with the LastMessage tag, instead of sending a terminate here.
//Actual terminate will be sent once all the messages upto this get acked
try {
if (Sandesha2Constants.SPEC_VERSIONS.v1_1.equals(rmSpecVersion)) {
SOAPEnvelope terminateEnvelope = configureTerminateSequence(options, serviceContext
.getConfigurationContext());
OMElement terminateBody = terminateEnvelope.getBody().getFirstChildWithName(
new QName(rmNamespaceValue,
Sandesha2Constants.WSRM_COMMON.TERMINATE_SEQUENCE));