Thats right Deepak,
I do not want to submit the form, rather I want to generate a PDF form with user filled data from AEM Form, so that that author can fill it offline and submit it later on.
So I have to stay on the form, but just build a PDF in back end and prompt the user to download the file.
Details about How Adaptive Form submission work and how you can customize it is available http://helpx.adobe.com/aem-forms/6/custom-submit-action-form.html . Connector invocation sample are available in link I sent you earlier. You can write your own custom submit action and invoke connector from there to get PDF, write that in temp storage. Then in Thank you page jsp, you can read that from temp storage and write in response.
B/w from the above use case, it does not look like you want to submit the form. Such cases are usually handled by writing the pdf in temp storage and then return the url of temp storage in process response in your ajax call. And then you can do window.open with returned url which would open the PDF in new window.
I found the following info while reading through the net,
1) Ajax handles only text as response (which explains why my call to the livecycle process though invokes the service, gets to the error function as my returned data is a binary file)
2) Now that Ajax call is out of the equation, I have to stick with the AEM Livecycle connector to get my job done.
Now that I know which direction to go, I have a few things to be understood before I take the leap.The call on submit action on AEM forms is directed to the submit call in the GuideBridge.js, having said that I wish to understand how the call is propagated from the submit function in GuideBridge.js to the Livecycle process invocation incase the author of the form has selected the submit action to be "Submit to Workflow".
The AEM and Livecycle instance are right now running on the same instance. And I lately found out that the service invocation does happen and the payload is passed to the livecycle process. but the issue is, the call is always handled by the error function of my ajax callback. Also my livecycle process is a short lived process. The service returns a PDF and I got to handle it in my invocation to download the returned READER EXTENDED PDF to the users desktop. Is there any reason why my ajax call, though successfully after invocation is handled by the error function.
Please enlighten me on how I can use the AEM connector to get my invocation done and how to handle the result of the invocation.
If your LiveCycle server is on different host/port then might be be hitting cross-domain restriction of browser. In that case, you would to write a proxy jsp/servlet deployed in AEM which in turn calls LiveCycle post process. You can optionally use LiveCycle AEM connector(helpx.adobe.com/livecycle/help/aem/aem-livecycle-connector.html) to invoke LiveCycle from AEM.