Commit ed5ec4b6 authored by dpawar's avatar dpawar

call PB component for misc voucher confirmation


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@96107 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 58ec48d2
......@@ -40,6 +40,10 @@ import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
import javax.xml.rpc.ParameterMode;
@Stateless // added for ejb3
public class MiscVchEmpIConf extends ActionHandlerEJB implements MiscVchEmpIConfLocal, MiscVchEmpIConfRemote
......@@ -448,10 +452,11 @@ private String generateMiscVoucher(String tranId, String xtraParams, String forc
System.out.println("miscVchTranId12345------>>>["+miscVchTranId+"]");
if(miscVchTranId != null && miscVchTranId.trim().length() > 0)
{
MiscValConf MiscValConfObj=new MiscValConf();
/*MiscValConf MiscValConfObj=new MiscValConf();df
errorStringMisc=MiscValConfObj.confirm(miscVchTranId, xtraParams, forcedFlag);
miscVoucherTranID.add(checkNull(miscVchTranId));
System.out.println("Return String from MiscValConf confirm---->["+errorStringMisc+"]");
miscVoucherTranID.add(checkNull(miscVchTranId));*/
errorStringMisc=confirmMiscVoucher("misc_voucher",miscVchTranId,xtraParams,forcedFlag,conn);
System.out.println("Return String from confirmMiscVoucher confirm---->["+errorStringMisc+"]");
if(!(errorStringMisc.indexOf("CONFSUCCES") > -1)){
return errorStringMisc;
}
......@@ -984,6 +989,110 @@ public String getStationEmployeeCode(Connection conn,String vouchNo)
}
return EmployeeCode+","+stanCode;
}
public String confirmMiscVoucher(String businessObj, String tranIdFr,String xtraParams, String forcedFlag, Connection conn) throws ITMException
{
String methodName = "";
String compName = "";
String retString = "";
String serviceCode = "";
String serviceURI = "";
String actionURI = "";
String sql = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
//ConnDriver connDriver = new ConnDriver();
//conn = connDriver.getConnectDB("DriverITM");
System.out.println("-------in confirmMiscVoucher mothod----------------");
tranIdFr=tranIdFr==null ? "" :tranIdFr.trim();
System.out.println("Tran id for misc Voucher note--->>"+tranIdFr+"]");
methodName = "gbf_post";
actionURI = "http://NvoServiceurl.org/" + methodName;
sql = "SELECT SERVICE_CODE,COMP_NAME FROM SYSTEM_EVENTS WHERE OBJ_NAME = ? AND EVENT_CODE = 'pre_confirm' ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,businessObj);
rs = pstmt.executeQuery();
if ( rs.next() )
{
serviceCode = rs.getString("SERVICE_CODE");
compName = rs.getString("COMP_NAME");
}
compName=compName==null ? "" :compName.trim();
System.out.println("serviceCode = ["+serviceCode+"] compName ["+compName+"]");
sql = "SELECT SERVICE_URI FROM SYSTEM_EVENT_SERVICES WHERE SERVICE_CODE = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,serviceCode);
rs = pstmt.executeQuery();
if ( rs.next() )
{
serviceURI = rs.getString("SERVICE_URI");
}
serviceURI=serviceURI==null ? "" :serviceURI.trim();
System.out.println("serviceURI---->>["+serviceURI+"]---> compName = ["+compName+"]");
Service service = new Service();
Call call = (Call)service.createCall();
call.setTargetEndpointAddress(new java.net.URL(serviceURI));
call.setOperationName( new javax.xml.namespace.QName("http://NvoServiceurl.org", methodName ) );
call.setUseSOAPAction(true);
call.setSOAPActionURI(actionURI);
Object[] aobj = new Object[4];
call.addParameter( new javax.xml.namespace.QName("http://NvoServiceurl.org", "component_name"), XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter( new javax.xml.namespace.QName("http://NvoServiceurl.org", "tran_id"), XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter( new javax.xml.namespace.QName("http://NvoServiceurl.org", "xtra_params"), XMLType.XSD_STRING, ParameterMode.IN);
call.addParameter( new javax.xml.namespace.QName("http://NvoServiceurl.org", "forced_flag"), XMLType.XSD_STRING, ParameterMode.IN);
aobj[0] = new String(compName);
aobj[1] = new String(tranIdFr);
aobj[2] = new String(xtraParams);
aobj[3] = new String(forcedFlag);
//System.out.println("@@@@@@@@@@loginEmpCode:" +genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginEmpCode")+":");
System.out.println("@@@@@@ call.setReturnType(XMLType.XSD_STRING) executed........");
call.setReturnType(XMLType.XSD_STRING);
retString = (String)call.invoke(aobj);
System.out.println("confirmMiscVoucher Return string from NVO is:==>["+retString+"]");
}
catch(Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try{
if (pstmt != null )
{
pstmt.close();
pstmt = null;
}
if( rs != null ){
rs.close();
rs = null;
}
}
catch(Exception e)
{
System.out.println("Exception inCalling confirmed");
e.printStackTrace();
try{
conn.rollback();
}catch (Exception s)
{
System.out.println("Unable to rollback");
s.printStackTrace();
}
throw new ITMException(e);
}
}
return retString;
}//end confirmCreditNote
public String checkNull(String input)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment