use of com.arjuna.webservices11.wscoor.client.ActivationCoordinatorClient in project narayana by jbosstm.
the class ActivationCoordinator method createCoordinationContext.
/**
* Create the coordination context.
* @param activationCoordinatorURI The URI of the activation coordinator.
* @param messageID The messageID to use.
* @param coordinationTypeURI The coordination type.
* @param expires The expiry time or null.
* @param currentContext The currnt context or null.
* @return The coordination context.
* @throws com.arjuna.wsc.InvalidCreateParametersException if the create parameters are invalid.
* @throws SoapFault for errors during processing.
*/
public static CoordinationContextType createCoordinationContext(final String activationCoordinatorURI, final String messageID, final String coordinationTypeURI, final Long expires, final CoordinationContext currentContext) throws InvalidCreateParametersException, SoapFault {
final MAP map = AddressingHelper.createRequestContext(activationCoordinatorURI, messageID);
final Expires expiresValue;
if (expires == null) {
expiresValue = null;
} else {
expiresValue = new Expires();
expiresValue.setValue(expires.longValue());
}
try {
CreateCoordinationContextResponseType response;
ActivationCoordinatorClient client = ActivationCoordinatorClient.getClient();
response = client.sendCreateCoordination(map, coordinationTypeURI, expiresValue, currentContext);
return response.getCoordinationContext();
} catch (final IOException ioe) {
throw new SoapFault11(ioe);
} catch (SOAPFaultException sfe) {
// TODO -- work out which faults we should really throw. in particular do we need to retain SoapFault
final SOAPFault soapFault = sfe.getFault();
final QName subcode = soapFault.getFaultCodeAsQName();
if (CoordinationConstants.WSCOOR_ERROR_CODE_INVALID_PARAMETERS_QNAME.equals(subcode)) {
Detail detail = soapFault.getDetail();
String message = (detail != null ? detail.getTextContent() : soapFault.getFaultString());
throw new InvalidCreateParametersException(message);
}
throw SoapFault11.create(sfe);
}
}
Aggregations