throw new IllegalStateException("Sequence already registered with proxy instance");
try
{
// set up addressing data
RMClientSequence candidateSequence = new RMClientSequence(this.epConfigMetaData.getConfig().getRMMetaData());
String address = getEndpointMetaData().getEndpointAddress();
String action = RMAddressingConstants.CREATE_SEQUENCE_WSA_ACTION;
AddressingProperties addressingProps = null;
URI backPort = candidateSequence.getBackPort();
if (backPort != null)
{
addressingProps = AddressingClientUtil.createDefaultProps(action, address);
addressingProps.setReplyTo(AddressingBuilder.getAddressingBuilder().newEndpointReference(backPort));
}
else
{
addressingProps = AddressingClientUtil.createAnonymousProps(action, address);
}
Map requestContext = getBindingProvider().getRequestContext();
requestContext.put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND, addressingProps);
// set up wsrm request context
QName createSequenceQN = RMProvider.get().getConstants().getCreateSequenceQName();
Map rmRequestContext = new HashMap();
List outMsgs = new LinkedList();
outMsgs.add(createSequenceQN);
rmRequestContext.put(RMConstant.PROTOCOL_MESSAGES, outMsgs);
rmRequestContext.put(RMConstant.SEQUENCE_REFERENCE, candidateSequence);
requestContext.put(RMConstant.REQUEST_CONTEXT, rmRequestContext);
// invoke stub method
invoke(createSequenceQN, new Object[] {}, getBindingProvider().getResponseContext());
// read WSRM sequence id from response context
Map rmResponseContext = (Map)getBindingProvider().getResponseContext().get(RMConstant.RESPONSE_CONTEXT);
RMCreateSequenceResponse createSequenceResponse = ((RMCreateSequenceResponse)((Map)rmResponseContext.get(RMConstant.PROTOCOL_MESSAGES_MAPPING)).get(RMProvider
.get().getConstants().getCreateSequenceResponseQName()));
String outboundId = createSequenceResponse.getIdentifier();
candidateSequence.setClient(this);
candidateSequence.setOutboundId(outboundId);
candidateSequence.setBehavior(createSequenceResponse.getIncompleteSequenceBehavior());
candidateSequence.setDuration(RMHelper.durationToLong(createSequenceResponse.getExpires()));
this.wsrmSequence = candidateSequence;
}
catch (Exception e)
{
throw new RMException("Unable to create WSRM sequence", e);