i 've set up a remote web service which needs a couple of parameters.
1 header for basic auth, a couple of params which are always the same, and 2 params which are specific to each request i am sending.
I even did a swagger service definition.
It works like a charm.
The result is xml .
My idea was to process the result inside a post process script to convert it to json.
But inside the scripts area i can not add a custom script to the service.
Is this possibility not implemented or i’am missing something?
(ok after upgrade to 2.1 this is solved)
My second idea to was to create a custom Scripting Service and call the remote web service inside the script.
var myparams = event.request.parameters ;
var_dump(myparams);
var result = platform.api.get(“mart/search”, myparams );
return result;
The output of the log file:
output of var dump:
object(Object)#2120450790 (2) {
[“searchterm”] =>
string(6) “winkel”
[“supplier”] =>
string(4) “flex”
}
According to my recent discussion with support engineer pre and post processing scripts are not available to Remote Web Service or Custom Scripting Services.
@mharvey I was mistaken on that front.
Had a follow up conversation with the dev team, and pre/post process scripts ARE supported for remote web services.
But you have to provide swagger definitions for your service, as the scripting engine uses these to know what verbs and resources to provide scripting support to.
Actually, I’d like to know specifically what is required in the swagger docs to enable the creation of pre/post scripts. My docs show up and seem to work okay, but I don’t get the option in the scripts window. My swagger js looks like this:
Thanks. I am on 2.1, and did change the service description to 2.o format, but the issue was the missing paths:. Now I see the pre and post options under script.