/**
   * Send a cancel request.
   *
   * @param map addressing context initialised with to and message ID.
   * @param identifier The identifier of the initiator.
   * @throws com.arjuna.webservices.SoapFault For any errors.
   * @throws java.io.IOException for any transport errors.
   */
  public void sendCancel(
      final W3CEndpointReference coordinator, final MAP map, final InstanceIdentifier identifier)
      throws SoapFault, IOException {
    MAPEndpoint participant = getParticipant(coordinator);
    AddressingHelper.installFromFaultTo(map, participant, identifier);
    final TerminationCoordinatorPortType port = getPort(coordinator, map, identifier, cancelAction);
    final NotificationType cancel = new NotificationType();

    port.cancelOperation(cancel);
  }
 private TerminationCoordinatorPortType getPort(
     final W3CEndpointReference endpoint,
     final MAP map,
     final InstanceIdentifier identifier,
     final String action) {
   // we only need the message id from the addressing properties as the address is already wrapped
   // up
   // in the ednpoint reference. also the identifier should already be installed in the endpoint
   // reference as a reference parameter so we don't need that either
   AddressingHelper.installNoneReplyTo(map);
   return WSARJTXClient.getTerminationCoordinatorPort(endpoint, action, map);
 }
  public static InitiatorPortType getInitiatorPort(MAP map, String action) {
    InitiatorService service = getInitiatorService();
    InitiatorPortType port =
        service.getPort(InitiatorPortType.class, new AddressingFeature(true, true));
    BindingProvider bindingProvider = (BindingProvider) port;
    String to = map.getTo();
    /*
           * we no longer have to add the JaxWS WSAddressingClientHandler because we can specify the WSAddressing feature
          List<Handler> customHandlerChain = new ArrayList<Handler>();
    customHandlerChain.add(new WSAddressingClientHandler());
    bindingProvider.getBinding().setHandlerChain(customHandlerChain);
           */
    Map<String, Object> requestContext = bindingProvider.getRequestContext();

    map.setAction(action);
    AddressingHelper.configureRequestContext(requestContext, map, to, action);

    return port;
  }
  // don't think we ever need this as we get a registration port from the endpoint ref returned by
  // the activation port request
  public static ParticipantPortType getParticipantPort(MAP map, String action) {
    ParticipantService service = getParticipantService();
    ParticipantPortType port =
        service.getPort(ParticipantPortType.class, new AddressingFeature(true, true));
    BindingProvider bindingProvider = (BindingProvider) port;
    String to = map.getTo();
    List<Handler> customHandlerChain = new ArrayList<Handler>();
    /*
           * we no longer have to add the JaxWS WSAddressingClientHandler because we can specify the WSAddressing feature
    customHandlerChain.add(new WSAddressingClientHandler());
           */
    /*
     * we need to add the coordination context handler in the case where we are passing a
     * coordination context via a header element
     */
    customHandlerChain.add(new CoordinationContextHandler());
    bindingProvider.getBinding().setHandlerChain(customHandlerChain);
    Map<String, Object> requestContext = bindingProvider.getRequestContext();

    map.setAction(action);
    AddressingHelper.configureRequestContext(requestContext, map, to, action);

    return port;
  }