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:
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:
||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.
||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.
- Locate the web.config file in the "C:\Program Files\K2 blackpearl\WebServices\runtimeservices" directory
- Use notepad to edit the file and locate the appSettings section (as shown below)
<add key="SubmitAsynchronously" value="false"/>
<add key="StartWorkflowAsynchronously" value="true"/>
- Change the key SubmitAsynchronously to true
- 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.