Take a survey

Developing Applications Using APIs > Rendering Forms > Calculating Form Data > Calculating form data using the web service API

Calculating form data using the web service API
To calculate form data using the web service API, perform the following tasks:
1.
2.
Create a FormsService object and set authentication values.
3.
Create a java.io.InputStream object by using the javax.servlet.http.HttpServletResponse object’s getInputStream method.
Create a java.io.ByteArrayOutputStream object by using its constructor and passing the length of the java.io.InputStream object.
Copy the contents of the java.io.InputStream object into the java.io.ByteArrayOutputStream object.
Create a byte array by invoking the java.io.ByteArrayOutputStream object’s toByteArray method.
Populate the BLOB object by invoking its setBinaryData method and passing the byte array as an argument.
Create a RenderOptionsSpec object by using its constructor. Set the locale value by invoking the RenderOptionsSpec object’s setLocale method and passing a string value that specifies the locale value.
Invoke the FormsServiceClient object’s processFormSubmission method and pass the following values:
The BLOB object that contains the form data.
A string value that specifies environment variables included all relevant HTTP headers. For example, you can specify the following string value:
HTTP_REFERER=referrer&HTTP_CONNECTION=keep-alive&
CONTENT_TYPE=application/xml
A string value that specifies the HTTP_USER_AGENT header value; for example, Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322).
A RenderOptionsSpec object that stores run-time options. For information about this object, see the LiveCycle ES API References.
An empty BLOBHolder object that is populated by the method.
An empty javax.xml.rpc.holders.StringHolder object that is populated by the method.
An empty BLOBHolder object that is populated by the method.
An empty BLOBHolder object that is populated by the method.
An empty javax.xml.rpc.holders.ShortHolder object that is populated by the method.
An empty MyArrayOf_xsd_anyTypeHolder object that is populated by the method. This parameter is used to store file attachments that are submitted along with the form.
An empty FormsResultHolder object that is populated by the method with the form that is submitted.
The processFormSubmission method populates the FormsResultHolder parameter with the results of the form submission. The processFormSubmission method returns a FormsResult object containing the results of the form submission.
Verify that the processing state associated with a submitted form is 1 by invoking the FormsResult object’s getAction method. If this method returns the value 1, then the calculation has been performed and the data can be written back to the client web browser.
4.
Create a javax.servlet.ServletOutputStream object used to send a form data stream to the client web browser.
Create a BLOB object that contains form data by invoking the FormsResult object’s getOutputContent method.
Create a byte array and populate it by invoking the BLOB object’s getBinaryData method. This task assigns the content of the FormsResult object to the byte array.
Invoke the javax.servlet.http.HttpServletResponse object’s write method to send the form data stream to the client web browser. Pass the byte array to the write method.
View Quick Start
 

 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/livecycle/es/sdkHelp/programmer/sdkHelp/renderingCalculatingData.41.4.html