You can use web services in SmartForms to:
- calculate field values
- populate options for fields that have multiple selection choices, e.g. radio buttons, check boxes, drop down lists.
Consider a simple scenario where the form has to:
- show a range of insurance policy type options and
- calculate and display an insurance policy premium based on selected policy type and other user input such as age
To implement this, SmartForms will have to interact with business systems, .i.e. fetch available policy types and run premium calculations based on user profile.
SmartForms support web services described in Web Services Description Language (WSDL) 1.1 with RPC/literal style and that have SOAP endpoints.
Table below lists types of web service calls that can be invoked by SmartForms:
|Get Field Options||A webservice method that is invoked when SmartForms require to fetch a list of choice options for a field||Name of a field that has to display choice options||An array of field name+value pairs for those fields that are needed to determine which choice options to return||An array of label+value pairs|
|Get Field Value||A webservice method that is invoked when SmartForms require to run a recalculation of a field value||Name of a field which value requires recalculation||An array of field name+value pairs for those fields that are needed for field value recalculation||A string representation of field value calculation result|
To simplify implementation of custom webservices we have narrowed down the webservice interface properties:
|soap version||1.1||Please make sure that the envelope contains soap11 and not soap12 tags|
|style||rpc or document||Make sure that your webservice uses an appropriate style as it will ensure that marshalling rules are met accordingly. To minimise integration effort it is advised that you follow sample code as provided in Java, PHP and .NET (WCF) examples.|
|use||literal||To verify it, check that WSDL <soap:body> element contains use="literal" attribute|
|http://smartforms/v1/||To verify it, check that WSDL elements contain namespace="http://smartforms/v1/" targetNamespace="http://smartforms/v1/" attributes|
Make sure that soap:action attribute of soap:operation element is a concatenation of a namespace and method name, e.g. if
method name is calculateXYZ, the soap action must be named http://smartforms/v1/calculateXYZ
|1st argument||fieldName||Make sure that the name of a first argument of a method is 'fieldName'|
|2nd argument||fields||Make sure that the name of second argument of a method is "fields"|
Samples presented in this article show how to enforce the above prerequisites within the software code.
The following instructions describe how to create sample webservice service for use by SmartForms: