FTP Service in SFCC - SFRA Architecture 📞
DanieleAurilio
Posted on August 6, 2021
Hi guys! 🖖
Have you to work with FTP service but it is your first time?
Don’t worry about it, SFCC provide a class called LocalServiceRegistry, with this class you can managing some request like HTTP, FTP and SOAP.
First of all we have to create a service in business manager on SFCC.
Let’s create service credentials and service profile: 🛠️
Go to Administration -> Services
Here we have three tabs:
- Services;
- Profiles: here we can specify ms time-out after a maximum number of failed call.
- Credentials: here we have to setup service credential.
Now we go to setup service credential:
Go setup service profiles:
And at the end we can setup Service:
After created service in business manager we can write our service call:
Create a file under the path cartridge/scripts/service.
Require LocalServiceRegistry.
LocalServiceRegistry.createService() accepts two parameters, first is the name of the service, second parameter passed is a config object were we create request and parse the response.
createRequest must have service passed as parameter, setOperation() method is exclusive for ftp service, you can find full list of operation you can execute Here
After in parseResponse you can manipulate response and its returned data, for example you can iterate response data.
As you have seen it isn’t difficult, indeed it is intuitive with LocalServiceRegistry class.
Now when you have to call this service you have to include it in a file and after use yourService.call();
Posted on August 6, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
November 29, 2024