Currently I am building up an external DLL for handling some business logic - we determined the best way to pass data from and to this DLL would be by strings and using XML - this all works fine, but now I want to make it easier to use the DLL by allowing the passage of the actual record which is retrieved with
GET() - currently we do it as follows:
But I want to move the logic of creating the XML into the called procedure of
Wrapper so something like:
But I don’t know what type to use for the declaration of
Wrapper.Method - any idea’s?
I tried using
? = but that it fails to serialize to XML - it’s just empty
Oh, I’ll try that - and guess it’s the same for returning a group?
Okay, this partially fixed it - sadly, now
xml.Save(pRecord) results in the following:
... fields of record
instead of when I use
... fields of record
Any idea how to fix that?
If this is xFiles 4? then use
@jslarve method above, declare the xml object as
The save as follows
In a simple test this gave me the following output
<?xml version="1.0" encoding="UTF-8"?>
I hope that helps
May 13, 2023, 4:14am
Yes, i think the key question here, is what class and what code, you are using yo create yhe xml from the record.
Also note that passing the record lije this excludes any memos or blobs - im not sure if thats an issue for you.
The whole procedure looks as follows:
EFinanceAPI.UpdateCustomer PROCEDURE(*GROUP customer)!,BSTRING
xml.SOAPEnvelope = 1 ! tells xFiles to wrap the XML in a SOAP envelope
xml.SaveEncoding = 'utf-8' ! default is 'ISO-8859-1'
xml._pfileBoundary = '' ! no file boundary tag required by this server
xml._pRecordBoundary = ''
xml.TagCase = XF:CaseAsIs !XF:CaseAsIs !XF:CaseLower !XF:CaseAny !XF:CaseAsIs !XF:CaseLower
xml.SOAPEnvelopeBoundaryAttribute = Clip('xmlns="Company.Domain"')
xml.SOAPEnvelopeBoundary = 'Customer'
xml.SOAPBodyBoundary = ''
xml.RemovePrefix = TRUE
xml.DontReplaceColons = TRUE
result = External_DLL_UpdateCustomer(SELF.instance, xml.xmlData);
@Mark_Sarson it’s xFiles 3.16
May 13, 2023, 4:12pm
At the very least, download the latest build of xFiles 3 - which is 3.27. There’s no reason to be on an old build.
then change the Save line to read;
BTW: Clarion doesn’t need semi-colons at the end of a line. And you can declare the object as just;
If you are using xFiles 4 then the
xFileXML class still exists, but you’re recommended to use the
xFilesStream class instead.
xml.Save(customer, '', '') did indeed fix it
Any hint on how to return a group/object from the procedure also?
Currently I return the XML string, but I rather return the
EFinanceResponse if possible
May 15, 2023, 1:51pm
You can declare a group externally as a TYPE, then use that as a parameter to EFinanceAPI.UpdateCustomer.
EFinanceAPI.UpdateCustomer PROCEDURE(*GROUP customer, *EFinanceResponseType rFinanceResponse )
xml.Load(rFinanceResponse , result);
Thank you! But for some reason the xml.Load isn’t loading the data for me - the Structure/Group stays empty - when I try to add the string LENGTH in the xml load as follows:
xml.Load(EFinanceResponse, xmlData, LEN(CLIP(xmlData)));
I get a
No Matching prototype available - probably because my
xmlData is a
BSTRING and not a
*STRING - any solution to that?
May 16, 2023, 2:22pm
create a string, copy xmldata into that string, then pass it to the LoadMethod. A StringTheory object would also work.