createSeqmsgContext.setAxisOperation(createSeqOperation);
createSeqmsgContext.setTo(applicationRMMsg.getTo());
createSeqmsgContext.setReplyTo(applicationRMMsg.getReplyTo());
RMMsgContext createSeqRMMsg = new RMMsgContext(createSeqmsgContext);
String rmVersion = SandeshaUtil.getRMVersion(internalSequenceId,context);
if (rmVersion==null)
throw new SandeshaException ("Cant find the rmVersion of the given message");
String rmNamespaceValue = SpecSpecificConstants.getRMNamespaceValue(rmVersion);
String addressingNamespaceValue = SandeshaUtil.getSequenceProperty(internalSequenceId,Sandesha2Constants.SequenceProperties.ADDRESSING_NAMESPACE_VALUE,context);
CreateSequence createSequencePart = new CreateSequence(factory,rmNamespaceValue,addressingNamespaceValue);
// Adding sequence offer - if present
OperationContext operationcontext = applicationMsgContext
.getOperationContext();
if (operationcontext != null) {
String offeredSequence = (String) applicationMsgContext
.getProperty(SandeshaClientConstants.OFFERED_SEQUENCE_ID);
if (offeredSequence != null && !"".equals(offeredSequence)) {
SequenceOffer offerPart = new SequenceOffer(factory,rmNamespaceValue);
Identifier identifier = new Identifier(factory,rmNamespaceValue);
identifier.setIndentifer(offeredSequence);
offerPart.setIdentifier(identifier);
createSequencePart.setSequenceOffer(offerPart);
}
}
SequencePropertyBean replyToBean = seqPropMgr.retrieve(
internalSequenceId,
Sandesha2Constants.SequenceProperties.REPLY_TO_EPR);
SequencePropertyBean toBean = seqPropMgr.retrieve(internalSequenceId,
Sandesha2Constants.SequenceProperties.TO_EPR);
if (toBean == null || toBean.getValue() == null)
throw new SandeshaException("To EPR is not set.");
EndpointReference toEPR = new EndpointReference(toBean.getValue());
EndpointReference replyToEPR = null;
EndpointReference acksToEPR = null;
String anonymousURI = SpecSpecificConstants.getAddressingAnonymousURI(addressingNamespaceValue);
if (acksTo == null || "".equals(acksTo))
acksTo = anonymousURI;
acksToEPR = new EndpointReference(acksTo);
if (replyToBean != null && replyToBean.getValue() != null)
replyToEPR = new EndpointReference(replyToBean.getValue());
if(createSeqRMMsg.getTo()==null)
createSeqRMMsg.setTo(toEPR);
// ReplyTo will be set only if not null.
if (replyToEPR != null)
createSeqRMMsg.setReplyTo(replyToEPR);
createSequencePart.setAcksTo(new AcksTo(
new Address(acksToEPR, factory, addressingNamespaceValue), factory,rmNamespaceValue,addressingNamespaceValue));
createSeqRMMsg.setMessagePart(
Sandesha2Constants.MessageParts.CREATE_SEQ, createSequencePart);
try {
createSeqRMMsg.addSOAPEnvelope();
} catch (AxisFault e1) {
throw new SandeshaException(e1.getMessage());
}
createSeqRMMsg.setAction(SpecSpecificConstants.getCreateSequenceAction(SandeshaUtil.getRMVersion(internalSequenceId,context)));
createSeqRMMsg.setSOAPAction(SpecSpecificConstants.getCreateSequenceSOAPAction(SandeshaUtil.getRMVersion(internalSequenceId,context)));
finalizeCreation(applicationMsgContext, createSeqmsgContext);
return createSeqRMMsg;
}