Manually Calling Web Services
With PowerForms, users could bind specific controls to existing web services and retrieve values automatically during form initialization or whenever another control that affected the web service call occurred.
In version 2.0, a new Button control is introduced, which allows users to manualy call web services, or list queries and apply the retrieved data to controls on the form.
Lets see a complete walkthrough to perform this task :
We assume that we already have a web service available.
For our example the web service only has one method (GetCustomer) that returns a Customer object.
The Soap Request and Response follows :
A test execution returns the following sample data :
One Customer record. 3 properties (ID, Name, Balance).
Notice that the "ID" property is serialized as attribute wheras the rest of the properties follow the default pattern (elements).
We now go to our form which looks like this :
We must add the Button control as well as the placeholders for the web service data.
We open the designer and drag-n-drop the controls from the toolbox.
As soon as we place the controls on the form, we switch to the Web Serices section, in order to define the Web Service Call.
We Create a new Web Service call and define the basic parameters (url, method name, xml namespace). Note that all these properties should be available in the Soap Definition.
Next, press the TEST button to read the xml response of the service. It sould be something like the following :
In order to get the required data from the xml, we should use XPATH.
An easy approach to escape from the namespace hell, is to use local names.
Here is my example to retrieve the GetCustomerResult xml node:
After setting the XPath property, we define the attributes we want to retrieve (ID, Name, Balance separated with semicolon).
While in the web service designer screen, we can try the web service and examine the retrieved data in the grid.
If everything seems to be fine, we must return to the Button properties and bind it to the Web Service.
We select the Web Service, and we bind the target controls with the attributes retrieved from the service.
We are ready to go now!
Save the configuration and test the button in the final form: