private static void setUpServiceClientAnonymousOperations (ServiceClient serviceClient) throws SandeshaException {
try {
AxisService service = serviceClient.getAxisService();
AxisOperation anonOutOnlyOperation = service.getOperation(ServiceClient.ANON_OUT_ONLY_OP);
if (anonOutOnlyOperation==null) {
anonOutOnlyOperation = AxisOperationFactory.getAxisOperation(WSDLConstants.MEP_CONSTANT_OUT_ONLY);
anonOutOnlyOperation.setName(ServiceClient.ANON_OUT_ONLY_OP);
AxisOperation referenceOperation = service.getOperation(Sandesha2Constants.RM_IN_ONLY_OPERATION);
if (referenceOperation!=null) {
anonOutOnlyOperation.setPhasesOutFlow(referenceOperation.getPhasesOutFlow());
anonOutOnlyOperation.setPhasesOutFaultFlow(referenceOperation.getPhasesOutFaultFlow());
anonOutOnlyOperation.setPhasesInFaultFlow(referenceOperation.getPhasesInFaultFlow());
anonOutOnlyOperation.setPhasesInFaultFlow(referenceOperation.getRemainingPhasesInFlow());
service.addOperation(anonOutOnlyOperation);
} else {
String message = "Cant find RM Operations. Please engage the Sandesha2 module before doing the invocation.";
throw new SandeshaException (message);
}
}
AxisOperation anonOutInOperation = service.getOperation(ServiceClient.ANON_OUT_IN_OP);
if (anonOutInOperation==null) {
anonOutInOperation = AxisOperationFactory.getAxisOperation(WSDLConstants.MEP_CONSTANT_OUT_IN);
anonOutInOperation.setName(ServiceClient.ANON_OUT_IN_OP);
AxisOperation referenceOperation = service.getOperation(Sandesha2Constants.RM_IN_OUT_OPERATION);
if (referenceOperation!=null) {
anonOutInOperation.setPhasesOutFlow(referenceOperation.getPhasesOutFlow());
anonOutInOperation.setPhasesOutFaultFlow(referenceOperation.getPhasesOutFaultFlow());
anonOutInOperation.setPhasesInFaultFlow(referenceOperation.getPhasesInFaultFlow());
anonOutInOperation.setPhasesInFaultFlow(referenceOperation.getRemainingPhasesInFlow());
//operation will be added to the service only if a valid referenceOperation was found.
service.addOperation(anonOutInOperation);
}
}