Pass retrieved record to procedure

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

Wrapper.Method(*GROUP pRecord)

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 xml.Save(Ktn:Record):

    ... fields of record

Any idea how to fix that?


If this is xFiles 4? then use @jslarve method above, declare the xml object as
xml xFilesTree

The save as follows
xml.Save(pRecord, 'filename.xml','record','')

In a simple test this gave me the following output

<?xml version="1.0" encoding="UTF-8"?>

I hope that helps

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             Class(xFileXML)
result          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);
        xml.Load(EFinanceResponse, result);
        RETURN xml.xmlData;

Edit: @Mark_Sarson it’s xFiles 3.16

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;

xml xFileXml

If you are using xFiles 4 then the xFileXML class still exists, but you’re recommended to use the xFilesStream class instead.

Thanks, changing xml.Save(customer) to 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

You can declare a group externally as a TYPE, then use that as a parameter to EFinanceAPI.UpdateCustomer.
as in
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?

create a string, copy xmldata into that string, then pass it to the LoadMethod. A StringTheory object would also work.