Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

Passing values from external application to Forms

Avatar

Level 1

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.

6 Replies

Avatar

Level 3

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();

Avatar

Level 10

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.

Avatar

Level 1

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

Avatar

Level 6

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.

Avatar

Level 6

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?

Avatar

Employee Advisor

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?