Hi Kandula,
I'm sure you know the .cvs is a binary file. GatewayScript unfortunately did not implement the XML write functions, so creating an XML file in GatewayScript would be an exercise of generating a well formed XML string. Since the cvs has each row being simply a record and each column within the row a row property, you should be able to split the .cvs using a \n to get each row, then split each row with a comma to get each column. I'd first have a wrapping xml elements, something like
<records>
Assuming your first row has a title, you could use it specifically as the element names (with perhaps some logic to handle illegal XML characters if present, perhaps remove spaces, etc), and for each row you would wrap each row with an <record> element and you could create <col1title>col1data</col1title> ... etc, for each column, of course terminating each row with a </record> and eventually the entire document with a </records>
Once you get the csv XML equivalent document string you can parse it into an XML DOM object and that could be your request XML, but if you needed some specific schema for your request, you could subsequently use a map policy with this schema as input to map the csv XML data to the schema you require for your backend server.
As for gateway extensions, if your gateway is not a kubernetes pod then you could handle pushing any extra DataPower objects such as MQ queue managers etc manually and they should be persisted across gateway restarts, but even in physical/virtual gateway scenarios, if you were to add a new Gateway, you'd have to not forget do that manual process then, whereas if those objects were in a gateway extension, they'd be handled when the new gateway was configured. The same would hold true for overriding default v10 objects, for example the parse settings object apic-default-parsesettings is one numerous customers have overridden to have larger parse settings than the default object provided, and again, just like the other DataPower objects mentioned above, having them in the extension ensures they are persisted in K8 pods and any new gateway deployment. If you were migrating from a v5 environment, the AMU migration utility would take all of your v5 user defined policies and store them in the gateway extension and they would be deployed to the v10 environment as an assembly function that would utilize the v5 emulation framework, so those v5 policies could be executed unchanged in v10.
Best Regards,
Steve Linn
------------------------------
Steve Linn
Senior Consulting I/T Specialist
IBM
------------------------------
Original Message:
Sent: Mon November 14, 2022 04:24 AM
From: kandula nagababu
Subject: file reading and Gateway extensions in v10
Hi Steve Linn,
for first question: we can able to get .csv file from gateway using url.open but how we can make xml request using .csv file.
for second question: yes I understand in v5 most of the people build custom policy for MQ URL calling and some logging information sending purpose, but in v10 we able to make same functionality without gateway extension also working fine, i think it is not depend on gateway extension. so what is the gateway extension real time scenario in v10.
------------------------------
kandula nagababu
Original Message:
Sent: Tue November 01, 2022 09:09 AM
From: Steve Linn
Subject: file reading and Gateway extensions in v10
Hi Kandula,
I don't believe the gatewayscript fs module is supported in APIC v10, but see https://www.ibm.com/docs/en/datapower-gateway/10.0.1?topic=apis-urlopen-module section urlopen.open() to open files on the DataPower Gateway which shows how to read local files from either the local, store or temporary directories. Once the file is read, you would access the data with a response.readAsXML, readAsJSON, or readAsBuffer function with the latter being what you'd want for your .csv.
Gateway extensions in v10 are used to deploy custom policies (either v5 custom/user defined policies which will require the v5 emulation properties in the extension's manifest.json file, or a v10 UDP), and also DataPower configuration and files. As an example of a use case, if you had to log your API to an MQ target, that would require a UDP, assuming this is something done for most APIs, to do the urlopen to send the data to your MQ backend, but the DataPower queue manager objects would be specified in the gateway extension. This was one of the use cases that was heavily used in v5 which is also applicable to v10. It can also be used to deploy overrides to some v10 objects such as the parse settings object apic-default-parsesettings, and also deploy individual files such as your csv.
Best Regards,
Steve
------------------------------
Steve Linn
Senior Consulting I/T Specialist
IBM
Original Message:
Sent: Tue October 25, 2022 11:04 AM
From: kandula nagababu
Subject: file reading and Gateway extensions in v10
Hi All,
--> Is there any way to read .csv files, what is its maximum readable file size and what are the formats supported to read APIC?
-->We are not found Exact use case for Gateway Extension in v10, Actually v5 Gateway Extension capabilities(generic error, generic format response, X-IBM-Client-id name customization) can be produced in v10 through global policies, so please provide some use cases on v10 gateway extensions.
------------------------------
kandula nagababu
------------------------------