XAPI Outbound Request Parsing API Usage Sample Code
This code sample shows the API usage for parsing an outbound request by the JD Edwards EnterpriseOne XAPI executor:
#include <jde.h> #define b0000310_c /***************************************************************************** * Source File: b0000310 * * Description: Company Real Time Notification Outbound Wrapper Source File * *****************************************************************************/ #include <b0000310.h> #include <B4206030.h> #include <B4206000.h> /************************************************************************** * Business Function: CompanyRealTimeWrapper * * Description: Company Real Time Notification Outbound Wrapper * * Parameters: * LPBHVRCOM lpBhvrCom Business Function Communications * LPVOID lpVoid Void Parameter - DO NOT USE! * LPDSD0000310A lpDS Parameter Data Structure Pointer * *************************************************************************/ int iXMLRecordCount = 0; int iCurrentRecord = 0; NID nidDSName; ID idReturnValue = ER_SUCCESS; ID idSORecordCount = ER_ERROR; /*Return Code*/ LPDSD4206000A lpDS; int lpmnJobNumber; MATH_NUMERIC mnBatchNumber = {0}; unsigned long lBatchNumber = {0}; DSD4206030A dsD4206030A = {0}; /* CacheProcessInboundDemandRequest B4206030.c */ DSD4206000I dsD4206000I = {0}; /* Demand scheduling inbound DSTR */ iXMLRecordCount = jdeXMLRequest_GetDSCount(lpDS->szXMLHandle); if( iXMLRecordCount > 0) { for ( iCurrentRecord = 0; iCurrentRecord < iXMLRecordCount; iCurrentRecord++) { memset((void *)(&dsD4206000I), (int)(_J('\0')), sizeof(DSD4206000I)); memset((void *)(nidDSName), (int)(_J('\0')), sizeof(NID)); if(jdeXMLRequest_GetDSName(lpDS->szXMLHandle,iCurrentRecord,nidDSName)) { /* Retrieving data*/ if (jdeStricmp(nidDSName, (const JCHAR *)_J("D40R0180B")) == 0) { if (jdeXMLRequest_ParseDS(lpDS->szXMLHandle,iCurrentRecord, &dsD4206000I,sizeof(DSD4206000I))) { /* Get next number for the batch number of the inbound INVRPT record*/ if ( dsD4206000I.cInventoryAdvisement == _J('1')) { lBatchNumber = JDB_GetInternalNextNumber(); LongToMathNumeric(lBatchNumber, &mnBatchNumber); FormatMathNumeric(dsD4206000I.szBatch,&mnBatchNumber); } /* Setup cancel flag for pending delete record */ if ( dsD4206000I.cPendingDelete == _J('1')) { /* Flag set as 1 for any cancel demand record */ dsD4206000I.cCancelFlag = _J('1'); } else { /* Flag set as 9 for any non cancel demand record */ dsD4206000I.cCancelFlag = _J('9'); } /* Load parms for cache */ //memset((void *)(&dsD4206030A), (int)(_J('\0')), sizeof(DSD4206030A)); I4206000_LoadParmsToCache(&dsD4206000I, &dsD4206030A); MathCopy(&dsD4206030A.mnJobnumberA, lpmnJobNumber); /* Add the DSTR to cache */ idReturnValue = jdeCallObject( _J("CacheProcessInboundDemand Request") ,(LPFNBHVR)NULL ,lpBhvrCom ,lpVoid ,(LPVOID)&dsD4206030A, (CALLMAP *)NULL, (int)0,(JCHAR*)NULL ,(JCHAR*)NULL ,(int)0 ); /* Write XML DSTR to cache fail */ if (idReturnValue == ER_ERROR) { jdeErrorSet(lpBhvrCom, lpVoid, (ID)0, _J("032E"), (LPVOID)NULL); } } else { /* warning XML parse fail */ jdeErrorSet(lpBhvrCom, lpVoid, (ID)0, _J("40R46"), (LPVOID) NULL); } } /* end if */ }/* end if DS name */ }/* end for - looping all matching XML DSTR */ /* Ensure there is at least one record */ idSORecordCount = ER_SUCCESS; }/*if( iXMLRecordCount > 0) */ return idSORecordCount;