Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package com.arjuna.webservices11.wsat.client;
  
 import  org.jboss.ws.api.addressing.MAPEndpoint;
 import  org.jboss.ws.api.addressing.MAPBuilder;
 import  org.jboss.ws.api.addressing.MAP;
 import  org.jboss.ws.api.addressing.MAPBuilderFactory;
 
The Client side of the Participant.

Author(s):
kevin
 
 public class ParticipantClient
 {
    
The client singleton.
 
     private static final ParticipantClient CLIENT = new ParticipantClient() ;

    
The prepare action.
 
     private String prepareAction = null;
    
The commit action.
 
     private String commitAction = null;
    
The rollback action.
 
     private String rollbackAction = null;
    
The SOAP fault action.
 
     private String faultAction;

    
The coordinator URI for replies.
 
     private MAPEndpoint coordinator ;

    
The coordinator URI for secure replies.
 
     private MAPEndpoint secureCoordinator ;

    
Construct the completion initiator client.
 
     {
         final MAPBuilder builder = MAPBuilderFactory.getInstance().getBuilderInstance();
 
         final String coordinatorURIString = ServiceRegistry.getRegistry().getServiceURI(.false);
         final String secureCoordinatorURIString = ServiceRegistry.getRegistry().getServiceURI(.true);
          = builder.newEndpoint(coordinatorURIString);
          = builder.newEndpoint(secureCoordinatorURIString);
     }

    
Send a prepare request.

Parameters:
map addressing context initialised with to and message ID.
identifier The identifier of the initiator.
Throws:
com.arjuna.webservices.SoapFault For any errors.
java.io.IOException for any transport errors.
 
     public void sendPrepare(final W3CEndpointReference endpointfinal MAP mapfinal InstanceIdentifier identifier)
         throws SoapFaultIOException
     {
         MAPEndpoint coordinator = getCoordinator(endpointmap);
         AddressingHelper.installFromFaultTo(mapcoordinatoridentifier);
         ParticipantPortType port = getPort(endpointmap);
         Notification prepare = new Notification();
 
         port.prepareOperation(prepare);
     }

    
Send a commit request.

Parameters:
map addressing context initialised with to and message ID.
identifier The identifier of the initiator.
Throws:
com.arjuna.webservices.SoapFault For any errors.
java.io.IOException for any transport errors.
    public void sendCommit(final W3CEndpointReference endpointfinal MAP mapfinal InstanceIdentifier identifier)
        throws SoapFaultIOException
    {
        MAPEndpoint coordinator = getCoordinator(endpointmap);
        AddressingHelper.installFromFaultTo(mapcoordinatoridentifier);
        ParticipantPortType port = getPort(endpointmap);
        Notification commit = new Notification();
        port.commitOperation(commit);
    }

    
Send a rollback request.

Parameters:
map addressing context initialised with to and message ID.
identifier The identifier of the initiator.
Throws:
com.arjuna.webservices.SoapFault For any errors.
java.io.IOException for any transport errors.
    public void sendRollback(final W3CEndpointReference endpointfinal MAP mapfinal InstanceIdentifier identifier)
        throws SoapFaultIOException
    {
        MAPEndpoint coordinator = getCoordinator(endpointmap);
        AddressingHelper.installFromFaultTo(mapcoordinatoridentifier);
        ParticipantPortType port = getPort(endpointmap);
        Notification rollback = new Notification();
        port.rollbackOperation(rollback);
    }

    
Send a fault.

Parameters:
map The addressing context.
soapFault The SOAP fault.
identifier The arjuna instance identifier.
Throws:
com.arjuna.webservices.SoapFault For any errors.
java.io.IOException for any transport errors.
    public void sendSoapFault(final MAP mapfinal SoapFault soapFaultfinal InstanceIdentifier identifier)
        throws SoapFaultIOException
    {
        ParticipantPortType port = getPort(nullmap);
        // convert fault to the wire format and dispatch it to the initiator
        soapFault.setAction() ;
        Fault fault = ((SoapFault11)soapFault).toFault();
        port.soapFault(fault);
    }

    
return a coordinator endpoint appropriate to the type of participant

Parameters:
endpoint
Returns:
either the secure coordinator endpoint or the non-secure endpoint
    MAPEndpoint getCoordinator(W3CEndpointReference endpoint, MAP map)
    {
        String address;
        if (endpoint != null) {
            NativeEndpointReference nativeRef = EndpointHelper.transform(NativeEndpointReference.classendpoint);
            address = nativeRef.getAddress();
        } else {
            address = map.getTo();
        }
        
        if (address.startsWith("https")) {
            return ;
        } else {
            return ;
        }
    }

    
Get the Completion Coordinator client singleton.

Returns:
The Completion Coordinator client singleton.
    public static ParticipantClient getClient()
    {
        return ;
    }

    
obtain a port from the participant endpoint configured with the instance identifier handler and the supplied addressing properties supplemented with the given action

Parameters:
participant
map
action
Returns:
    private ParticipantPortType getPort(final W3CEndpointReference participant,
                                                final MAP map,
                                                final String action)
    {
        AddressingHelper.installNoneReplyTo(map);
        if (participant != null) {
            return WSATClient.getParticipantPort(participantactionmap);
        } else {
            return WSATClient.getParticipantPort(actionmap);
        }
    }
New to GrepCode? Check out our FAQ X