This article was created in response to a support issue logged with K2. The content may include typographical errors and may be revised at any time without notice This article is not considered official documentation for K2 software and is provided “as is” with no warranties.

Issue

After restarting the K2 blackpearl service, a SmartForms that makes use of Endpoints WebService SmartObjects errors with "Invalid WSDL".

Symptoms

1. After restarting the K2 blackpearl service, the first execution of an Endpoints WebService SmartObjects will require the Endpoints WebService broker to read the WSDL of the web service again to build out and register this web service as a dynamic assembly before it can call the methods of the web service.

2. This web service/WSDL is quite large in size/definitions; and does take a bit more time to load/read the WSDL and to build/register the dynamic assembly.

3. Execution of the same web service SmartObject via the SmartObject Service Tester tool does not error after a K2 blackpearl service restart.

4. It was determined that this error would appear if a SmartForms's Initialize method was calling multiple Endpoints WebService SmartObjects in a 'Concurrent/Asynchronous' block:

https://help.k2.com/kb001432

When doing so, the second web service call would be made before the first web service call is able to read and generate the dynamic assembly needed to make a successful call.  All calls thereafter is successful.  The call is successful in the SmartObject Service tester tool because only one call is made and as such it was able to generate and register the dynamic assembly during this call.

Resolution

As this behavior of the EndPoint Webservice broker is expected, different implementations exists to avoid this error:

1. As part of the K2 service restart procedure; perform a refresh of the endpoint web service instance using perhaps the SmartObject Service Tester tool; this will generate and register the needed dynamic assembly before users access the forms.

2. Or as part of the K2 service restart procedure; perhaps implementing a 'warm-up' workflow, form, or application that makes use of the K2 API to call a SmartObject Read/List for each endpoint web service service instance to ensure that the broker is ready before user access.

3. Reconfigure the SmartForms rule to such that it is called 'one after another', 'in a batch' or with a single EndPoint Web Service SmartObject call in a 'one after another' block first and then any other execution blocks can be used after (to serve as a 'warmup' SmartObject call).