Chapter 12. J2EE Connector Architecture scenario 431
public MartAccounts deleteMartAccount_CICS(MartAccounts input) throws
Exception{
MartAccounts respOutput_forDelete = null;
try{
MartJ2CBeanImplProxy proxy = new MartJ2CBeanImplProxy();
respOutput_forDelete = proxy.deleteCustomer(input);
}catch (Exception e){
System.out.println("JCAWSClientBean -
deleteMartAccount_CICS failed" + e.toString());
throw e;
}
return respOutput_forDelete;
}
12.4.4 Integrate the JCA service client with Processor
Now we are ready to integrate the two components.
Processor.java calls the JCA service client.
Attention: During this project we ran into a few problems using the early
version of Rational Software Architect. We anticipate the fixes for these
problems to be included in a near future Fix Pack. In the meantime, here are
the problems that we ran into and the work-arounds we used.
򐂰 Problem 1: Change the componentNameLink value in bnd file.
a. Open
JCAClient/ejbModule/META-INF/ibm-webservicesclient-bnd.xmi.
b. Replace the value ___SET_THIS_TO_ejb-name___ of
componentNameLink to JCAWSClient.
򐂰 Problem 2: Change the
componentNameLink value in ext file.
a. Open
JCAClient/ejbModule/META-INF/ibm-webservicesclient-ext.xmi.
b. Replace the value ___SET_THIS_TO_ejb-name___ of
componentNameLink to JCAWSClient.
򐂰 Problem 3: Add serializable statement in MartAccounts.java.
a. Open
JCAClient/ejbModule/com.ibm.patterns.jcaService/MartAccounts.
java.
b. Add implements java.io.Serializable to public class MartAccounts:
public class MartAccounts implements java.io.Serializable {
432 Patterns: Implementing Self-Service in an SOA Environment
򐂰 Processor.java can be found in ProcessorEJB EJB Project
򐂰 Package com.ibm.patterns.serialProcess.
Example 12-16 shows the snippet of code in Processor.java that invokes the
Web service for the JCA call.
Example 12-16 Call to JCA in Processor.java
private void createCustomer() {
//Call to CreditRating application
String creditRating = new ProcessorWebService().getCreditRating(customerDetails);
if (isCreditSatisfactory(creditRating)) {
//Credit is Satisfactory
//Create customer in CRM and send Acceptance Mail
ProcessorJCA.storeCustomerDetails_CICS(customerDetails);
new MailService().sendActivationMail(customerDetails);
System.out.println("Customer created successfully....");
}
else {
//Credit rating is not satisfactory
//Delete customer from Db2 and send rejection Email
deleteCustomerfromDB();
new MailService().sendRejectionEmail(customerDetails);
System.out.println("The customer does not have satisfactory credit");
}
}
private void deleteCustomer() {
ProcessorJCA.deleteCustomerDetails_CICS(pkey);
deleteCustomerfromDB();
new MailService().sendDeletionEmail(pkey);
System.out.println("Customer deleted successfully...");
}
private void updateCustomer() {
ProcessorJCA.updateCustomerDetails_CICS(pkey);
new MailService().sendUpdationEmail(customerDetails);
System.out.println("Customer details updated successfully...");
}
}

Get Patterns: Implementing Self-Service in an SOA Environment now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.