Hi Kandula,
Just to confirm, this is a API Connect forum although your questions seems more pure DataPower oriented, so are you attempting to do the above with API Connect?
Specifically to your questions:
-->Can Gateway Script support backend calling through "var://service/routing-url" it is not working in one service.
var://service/routing-url is specific to "multi-step" policies like the Multi-Protocol Gateway, Web Service Proxy, and XML Firewall. It does NOT apply to the API Gateway service, the native API service provided in v10. Although API Connect's gateway in v5/v5c is a MPGW, you should never use this variable as you are specifying the url that the MPGW will send whatever message payload it has to some backend url. If you were to use the proxy policy in v5/v5c, essentially that is what that policy is doing (amongst other things), setting this variable and var://service/routing-url-sslprofile based upon the configuration of the proxy policy. If you're in your own MPGW, WSP, or XMLFW, then yes you can set this variable and at the end of the multistep request rule, that url will be used as the target and any response it returns will be made available to the multistep response rule for processing. If you're in an GatewayScript policy within API Connect, then you should use a urlopen.open function, but as noted earlier, this will only support http, https, mq, dpmq, and graphql protocols. If you need another protocol such as sql or (s)ftp, then you're only option will be to use the transform module to do a transform.xslt function to call an xslt stylesheet where the stylesheet would use the dp:url-open extension function. The transform.xslt call may pass a payload (as XML as a stylesheet only accepts XML as a payload), parameters (which can be strings or other data types), and the stylesheet can return back to the gatewayscript either XML or non XML responses that the code may evaluate.
-->We trying to call FTP backend in another service using XSLT it is also not working please see the screen shot and we followed below link.Link: https://www.ibm.com/docs/en/datapower-gateway/2018.4?topic=open-url-ftp
I've not done a lot of FTP in my DataPower career. The link you specify should have the information required. Your screen shot shows an error connecting. Are you providing a user:password as shown in the examples? Perhaps if you were to enable debug logging you might get more information indicating why the connection cannot be established. Looking at the logs it also appears that your MPGW has specified a dynamic backend but you are not setting the var://service/routing-url. If you're using a urlopen to get to your ftp backend, then you should be able to specify var://service/mpgw/skip-backside with a value of 1. This will tell DataPower that there is no backend to connect to, and the result of your OUTPUT context of the request rule should be returned to the client. Without this, you're probably getting an error from the service regardless of the success or failure of your stylesheet doing the urlopen.
--> Is there any possibility to read the FTP:// file and do the transformations using DataPower
It should be possible using the dp:url-open xslt extension function, and once you have read the file, DataPower's sweet spot is transformation with the caveat of the size of the read payload. I wouldn't suggest using DataPower for reading huge files. What type of file and size of files are you looking to read?
Regards,
Steve
------------------------------
Steve Linn
Senior Consulting I/T Specialist
IBM
------------------------------
Original Message:
Sent: Mon October 17, 2022 03:09 AM
From: kandula nagababu
Subject: SQL URL call using Getaway Script
Hi Steve Linn,
Please resolve below Doubts:
-->Can Gateway Script support backend calling through "var://service/routing-url" it is not working in one service.
-->We trying to call FTP backend in another service using XSLT it is also not working please see the screen shot and we followed below link.Link: https://www.ibm.com/docs/en/datapower-gateway/2018.4?topic=open-url-ftp
--> Is there any possibility to read the FTP:// file and do the transformations using DataPower
Please provide the any sample codes for make it work.
------------------------------
kandula nagababu
Original Message:
Sent: Fri October 14, 2022 10:00 AM
From: Steve Linn
Subject: SQL URL call using Getaway Script
Hi Kandula,
In DataPower, the urlopen module does not support the sql protocol. Per https://www.ibm.com/docs/en/datapower-gateway/10.0.1?topic=apis-urlopen-module,
The urlopen module provides APIs to establish a non-streaming connection with target servers by HTTP, HTTPS, Kafka, or IBM® MQ protocol and open files in the DataPower® file system.
A stylesheet with a url-open extension function is your only option as you have discovered. If you're doing some processing in your GatewayScript that wants to process the results of the urlopen, you can use the transform.xslt module/function to call a xslt from your GatewayScript specifically to do the dp:url-open and return the results so the GatewayScript may process it.
Best Regards,
Steve
------------------------------
Steve Linn
Senior Consulting I/T Specialist
IBM
Original Message:
Sent: Thu October 13, 2022 01:27 AM
From: kandula nagababu
Subject: SQL URL call using Getaway Script
Hi All,
We trying to call SQL data source URL through Gateway Script in DataPower. it is not calling to database and getting below error "url open: un supported target sql://MS-SQL-DB/static?select * from emp101 or protocol 'sql' " the same URL was working fine through XSLT dp:url-open function through.
Please tell me the solution or reason for this issue.
------------------------------
kandula nagababu
------------------------------