Implementing an openAccount transaction

To implement an openAccount transaction, perform the following procedure:

  1. 1. Define the openAccount transaction in the openAccountOp.xml file.
    <Op_Open_Account>
         <operation context="openAccountCtx" id="openAccountOp" implClass="com.ibm.btt.sample.operation.OpenAccountOperation">
              <refFormat name="csReplyFormat" refId="openAccountOpRecFmt"/>
         </operation>
    </Op_Open_Account>
  2. Define the openAccount context in the dsectxt.xml file.
    	<context id="openAccountCtx" type="op">
    		<refKColl refId="openAccountData" />
    	</context>
  3. Define the openAccount data element in the dsedata.xml file.
    	<kColl id="openAccountData">
    		<refData refId="accountName" />
    		<refData refId="accountID" />
    		<refData refId="accountPassword" />
    		<refData refId="sex" />
    		<refData refId="birthday" />
    		<refData refId="telephone" />
    		<refData refId="company" />
    		<refData refId="address" />
    		<refData refId="email" />
    		<refData refId="AccountNumber" />
    		<refData refId="TrxReplyCode" />
    		<refData refId="TrxErrorMessage" />
    	</kColl>
  4. Define the openAccount data format in the dsefmts.xml file.
    	<fmtDef id="openAccountOpRecFmt">
    		<record>
    			<fString dataName="AccountNumber" />
    			<delim delimChar="#" />
    			<fString dataName="TrxReplyCode" />
    			<delim delimChar="#" />
    			<fString dataName="TrxErrorMessage" />
    			<delim delimChar="#" />
    		</record>
    	</fmtDef>
    	<fmtDef id="openAccountOpSendFmt">
    		<record>
    			<constant value="Tx02" />
    			<delim delimChar="#" />
    			<fString dataName="accountName" />
    			<delim delimChar="#" />
    			<fString dataName="accountID" />
    			<delim delimChar="#" />
    			<fString dataName="accountPassword" />
    			<delim delimChar="#" />
    			<fString dataName="sex" />
    			<delim delimChar="#" />
    			<fString dataName="birthday" />
    			<delim delimChar="#" />
    			<fString dataName="telephone" />
    			<delim delimChar="#" />
    			<fString dataName="company" />
    			<delim delimChar="#" />
    			<fString dataName="address" />
    			<delim delimChar="#" />
    			<fString dataName="email" />
    			<delim delimChar="#" />
    		</record>
    	</fmtDef>
  5. Define the JMS invoker for openAccount transaction in the invoker.xml file.
    <JMS id="packageSend" connectionFactory="jms/sampleConnectionFactory"
      sendDestination="jms/backendEmulatorQueue">
    </JMS>
  6. Implement the execute() method of openAccount transaction in <toolkit_root>/samples/BTTMultiChannleSample/SampleBusiness/com.ibm.btt.sample.operation. OpenAccountOperation.java.
    	public void execute() throws Exception {
    		
    		System.out.println("====== OpenAccount Start =====");
    		// call JMS
    		String useJMS="false";
    		useJMS=mark.getString("useJMS");
    		Invoker jmsInvoker=null;
    		if(useJMS.equals("true")){
    			jmsInvoker= InvokerFactory.getDefaultInvokerFactory().createInvoker("packageSend");
    			String message=" OpenAccountOperation ......., request data : 1000";
    			
    			jmsInvoker.execute(new Object[]{message});
    		}
    		setValueAt(HtmlConstants.REPLYPAGE, "transfercomplete.jsp");
    		setValueAt("AccountNumber","888888888888");
    		setValueAt("errorCode", HtmlException.OK);
    		setValueAt("TrxReplyCode","OK");
    		setValueAt("TrxErrorMessage","OK");
    	}
Note: The block of code demonstrates how to use BTT JMS invoker to call a JMS application.