serenity_now
Active Member
Hi All,
I will be the first to admit I would never usually touch C Business Functions. However, I have to follow some guides / do some digging and create one that consumes an external web service by calling an Internal BSSV. This is working good, however, one of the return fields in my data structure is a character field, EV01. I can't seem to find any examples using a field like this, I have found math numeric, jdedate, strings but not these. I was hoping someone could help me out.
Here is the portion of code that that gets the EV01 value from the data structure of the BSFN. This takes the value and from what I understand from reading other examples it takes the character and sets it to a JCHAR variable szRecordWritten1or2[2] variable. This part works and if something is passed in I can access the value in my BSSV:
This part is meant to return the value back to the DSTR, I can't get this to work.
For comparison sake, here is one that does work:
Apologies if this is something I should know, but my exposure to C code is minimal and I am just using for the purpose of calling this web service. The error I get on compiling is
C:\E910\DV910\source\N5555.c(821) : warning C4047: 'function' : 'JCHAR *' differs in levels of indirection from 'JCHAR'
C:\E910\DV910\source\N5555.c(821) : warning C4024: 'jdeStrcpyFillAndTerminate' : different types for formal and actual
I will be the first to admit I would never usually touch C Business Functions. However, I have to follow some guides / do some digging and create one that consumes an external web service by calling an Internal BSSV. This is working good, however, one of the return fields in my data structure is a character field, EV01. I can't seem to find any examples using a field like this, I have found math numeric, jdedate, strings but not these. I was hoping someone could help me out.
Here is the portion of code that that gets the EV01 value from the data structure of the BSFN. This takes the value and from what I understand from reading other examples it takes the character and sets it to a JCHAR variable szRecordWritten1or2[2] variable. This part works and if something is passed in I can access the value in my BSSV:
Code:
/* Get the Record Written value element and set its value to passed in Record Written parameter */
XRCSStatus = XRCS_getElementsByTagName(hRootElm, _J("CRecordWritten1or0"), &hElm,&nElmCount);
if(XRCSStatus != XRCS_SUCCESS)
{
jdeVWriteLogEntry(_J("N5555"), __FILE__, __LINE__, 0, _J("XRCS_getElementsByTagName failed"));
XRCS_freeParser(hParser);
XRCS_freeDocument(hDoc);
XRCS_freeElement(hRootElm);
XRCS_terminateEngine();
return ER_ERROR;
}
szRecordWritten1or0[0] = lpDS->cRecordWritten1or0;
szRecordWritten1or0[1] = _J('\0');
XRCSStatus = XRCS_setElementText(hElm[0],szRecordWritten1or0);
if(XRCSStatus != XRCS_SUCCESS)
{
jdeVWriteLogEntry(_J("N5555"), __FILE__, __LINE__, 0, _J("XRCS_setElementText failed"));
XRCS_freeParser(hParser);
XRCS_freeDocument(hDoc);
XRCS_freeElement(hRootElm);
XRCS_freeElementArray(hElm,nElmCount);
XRCS_terminateEngine();
return ER_ERROR;
}
This part is meant to return the value back to the DSTR, I can't get this to work.
Code:
if (jdeStricmp(elmName,_J("CRecordWritten1or0"))==0) {
jdeStrncpyTerminate((JCHAR *)lpDS->cRecordWritten1or0, elmValue, lpDS->cRecordWritten1or0);
}
For comparison sake, here is one that does work:
Code:
if (jdeStricmp(elmName,_J("sz-name-surname"))==0) {
jdeStrncpyTerminate((JCHAR *)lpDS->szNameSurname, elmValue, DIM(lpDS->szNameSurname));
}
Apologies if this is something I should know, but my exposure to C code is minimal and I am just using for the purpose of calling this web service. The error I get on compiling is
C:\E910\DV910\source\N5555.c(821) : warning C4047: 'function' : 'JCHAR *' differs in levels of indirection from 'JCHAR'
C:\E910\DV910\source\N5555.c(821) : warning C4024: 'jdeStrcpyFillAndTerminate' : different types for formal and actual
Last edited: