Highlighted

Passing values from external application to Forms

barithaya

27-08-2018

Hi,

We have a mobile app and there is a need to integrate adaptive form within the app.

For this integration, session handover happens from the mobile app to the adaptive form created as below :

https://<host>/content/forms/af/mobileservice.html

this html we need to call from our mobile app and we will call the url and in post method will passon the customer number for single signon.

classification=K_EDGE|0&ip=1.1.1.1&msg=1111222|C123E7C37A52DC98CD56347CF9E2D794|2066884979|MCHMEFNISH&channel=mobile

data marked in bold is customer details that we pass on for integration, which has the customer details.

GET & POST method are the only options  available to integrate with any third party applications.

If we use GET method then the site is working fine.

But when we use the POST method to call the url, we are getting error as below:

25.04.2018 13:45:07.702 *ERROR* [42.106.236.63 [1524644107699] POST /content/forms/af/mobileservice.html HTTP/1.1] org.apache.sling.servlets.post.impl.operations.ModifyOperation Exception during response processing.

javax.jcr.nodetype.ConstraintViolationException: No matching property definition: classification = K_EDGE|0

  at org.apache.jackrabbit.oak.jcr.delegate.NodeDelegate.setProperty(NodeDelegate.java:522)

  at org.apache.jackrabbit.oak.jcr.session.NodeImpl$35.perform(NodeImpl.java:1375)

  at org.apache.jackrabbit.oak.jcr.session.NodeImpl$35.perform(NodeImpl.java:1363)

  at org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.perform(SessionDelegate.java:208)

  at org.apache.jackrabbit.oak.jcr.session.ItemImpl.perform(ItemImpl.java:112)

  at org.apache.jackrabbit.oak.jcr.session.NodeImpl.internalSetProperty(NodeImpl.java:1363)

Please help or let me know in case of additional details required.

Replies

Highlighted

lesutton1

27-08-2018

If you are trying to create a pre-fill service, you can use the standard 'dataRef' in your URL. You can also read the URL by looking at the request to retrieve any parameters passed in.

public InputStream getDataXMLForDataRef(DataXMLOptions dataXMLOptions) throws FormsException {

  String ref = dataXMLOptions.getDataRef();

Highlighted

smacdonald2008

28-08-2018

Checked with the team. The response was:

Post method is not supported by default for Form render. Customer has to add post.jsp via customization.

  One strategy they could use is to post to a custom end point within AEM that do internal forward (via get call) to form.

Highlighted

Mayank_Gandhi

Employee

28-08-2018

The use case is not very clear, can you share more details on how you are passing the Data and have you written your own servlet?

Highlighted

Jared_Langdon

31-08-2018

Lee.  How do you "read the URL by looking at the request to retrieve any parameters passed in" from the getDataXMLForDataRef method of the custom pre-fill service?

Highlighted

barithaya

10-09-2018

We implemented this by creating a custom servlet and passing the data in POST method to the servlet and then internally calling the adaptive form.

Thanks

Highlighted

Jared_Langdon

10-09-2018

Can you explain what you mean by "calling the adaptive form"?  Can you provide some lines of Java from your servlet that corresponds to "calling" the form?  Thanks.