Executing slingPostServlet operation in workflow | Community
Skip to main content
Level 3
October 16, 2015
Solved

Executing slingPostServlet operation in workflow

  • October 16, 2015
  • 1 reply
  • 737 views

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 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Ove_Lindström

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

1 reply

Ove_LindströmAccepted solution
Level 6
October 16, 2015

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