Expand my Community achievements bar.

SOLVED

Executing slingPostServlet operation in workflow

Avatar

Level 3

Hi There , 

   I have a servlet which returns me a json and using sling post servlet from a jsp page I post entire json and new nodes gets created in jcr . Now i have a requirement to execute the same behaviour from a workflow . Is there any way where I can execute ,  slingPostServlet from a workflow directly by passing json string ? I know thet i can write a process step which would actually parse json string and using JCR API create nodes programatically . Just want to avoid that overhead and use sling post servlet 

1 Accepted Solution

Avatar

Correct answer by
Level 6

Using the Sling Post Servlet to create nodes when you are in a Process is to add overhead, not avoid it. The turnaround to create and send a HTTP Request to let the servlet take care of it is in my humble opinion to go over the river to get water. It is roughly the same amount of code to convert from JSON to http request than from JSON and directly to node. And you don't have to mess around with HTTP Requests.

And, the solution with HTTP Request is harder to test and maintain.

/Ove

View solution in original post

1 Reply

Avatar

Correct answer by
Level 6

Using the Sling Post Servlet to create nodes when you are in a Process is to add overhead, not avoid it. The turnaround to create and send a HTTP Request to let the servlet take care of it is in my humble opinion to go over the river to get water. It is roughly the same amount of code to convert from JSON to http request than from JSON and directly to node. And you don't have to mess around with HTTP Requests.

And, the solution with HTTP Request is harder to test and maintain.

/Ove