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();
Top comments (0)