< class="prominent-subhead ">

How to Change InfoPath Submit Parameters

This article has been archived, and/or refers to legacy products, components or features. The content in this article is offered "as is" and will no longer be updated. Archived content is provided for reference purposes only. This content does not infer that the product, component or feature is supported, or that the product, component or feature will continue to function as described herein.


When submitting an InfoPath form, users may receive the following: "An error occurred while the form was being submitted". Although this error appears and gives the impression that a process was not submitted, on the server side a process may be started.
To correct this issue, the security level must be changed to allow the necessary level of user interaction. Fundamentally, this requires the security level to be reduced.

This error occurs because the InfoPath form has a time out value for the Web Service to respond. If the Web Service does not respond within this time period, the error is displayed to the user. However, the Web Service may still be processing the form data and may create a process instance.

This article will elaborate on why this error occurs and how to change the InfoPath Submit parameters to fix this issue.

Note: Implementing this solution requires knowledge of Web programming basics and familiarity with XML configuration files.

The InfoPath Form Submission

The InfoPath form can submit Synchronously or Asynchronously. The main difference between these two methods is whether or not the form waits for a response from the server before continuing. When configured for Synchronous operation (which is the default), the client form will wait for 30 seconds for a response from the Web Service to determine if the form submission has taken place. If no response is received within this wait time, the error described in the introduction is generated.

The InfoPath form does offer the option to alter the time out setting. Using this feature however requires using code-enabled forms.
Note: K2 blackpearl does not natively support code-enabled InfoPath Forms.

The InfoPath Form Submission

Code-enabled forms are not currently supported by K2 blackpearl, therefore a "K2 enabled" InfoPath form cannot be deployed with a time out setting other than the default 30 seconds.

There is a solution, however, without using code-enabled InfoPath forms. The InfoPath form can be configured to submit Asynchronously. This will allow the client form to close and assume that a process was started based on the submit event. Simply put, the form will not wait for the Web Service to respond, but will continue on with the assumption that the submission took place successfully.

The two diagrams below illustrate the difference:

Synchronous Operation


Asynchronous Operation


In order to allow the form to submit Asynchronously, there is a key in the configuration file for the K2 Web Service that must be changed. This parameter is the SubmitAsynchronously key, and has values of true or false:

False If the parameter is set to false, the form will wait for a response from the Web Service to indicate if the form was submitted successfully. When configured to false, the form is submitted Synchronously.
True If the parameter is set to true, the form will not wait for a response, and instead assumes that the form was submitted successfully. When configured to true, the form is submitted Asynchronously.

How to change the Submit Configuration
The steps below describe how the SubmitAsynchronously key can be set to true, enabling the form to submit Asynchronously.

  1. Locate the web.config file in the "C:\Program Files\K2 blackpearl\WebServices\runtimeservices" directory
  2. Use notepad to edit the file and locate the appSettings section (as shown below)
          <add key="SubmitAsynchronously" value="false"/>
          <add key="StartWorkflowAsynchronously" value="true"/>
  3. Change the key SubmitAsynchronously to true
  4. Close and save the file
Note: Once your changes have been made, be sure to save and close the web.config file. Perform an IIS Reset to ensure that the Web Service is updated.

Post Configuration Changes

Once the changes have been implemented, an IIS Reset is recommended to ensure the Web Service is updated. It is important to note that the first time a form is submitted, either after an IIS Reset or a reboot, a time out may occur as well. This is because the .NET "Just in Time" compiler actually compiles the MSIL to machine code the first time the Web Service is run. This can actually take longer than 30 seconds, thus a timeout will occur. This should happen only after an install or an IIS Reset. Although this cannot be avoided, it should not create repetitive problems.