Consume Web Services in Powerbuilder 12.5 Using Proxy Wizard

As mentioned in my previous post on consuming Web Services in Powerbuilder, there are two ways - using either Web Service datasource or Proxy Wizard.

Here I will demonstrate how can we consume a Consume Web Services in Powerbuilder 12.5 Using Proxy Wizard.

Below are the steps:

Step 1. Navigate to File -> New -> Project -> Web Service Proxy wizard -> Ok

Step 2. In 'About Web Service Proxy Wizard' screen, check the option Use .Net Engine if you want a dll to be created.
Note: If you are using .Net engine, make sure .Net SDK 4.0 is installed in your machine.

Step 3. In WSDL file name, copy and paste the link http://www.webservicex.net/CurrencyConvertor.asmx?WSDL



Step 4. Select the Service


Step 5. Select the Port


Step 6. Provice a Proxy name or else leave it blank for default name.



 Step 7. Browse the target library.
 

Step  8. Click finish


Step 9.  Right click on library and Import PBSoapClient125.pbx file from C:\Program Files (x86)\Sybase\Shared\PowerBuilder. Now we have soapconnection and soapexception in our library.

Step 10. Now right click on Project Name and select deploy. This will generate the proxy object. The proxy object has functions which we use to communicate through web service.


Expand the Proxy(click + sign) and then check the functions that can be used. Check the arguments and return type.


Step 11. Create a Window as shown below:


Step 12. In the buttons clicked event, write the code to get the exchange value
//Sample Code
p_currencyconvertercurrencyconvertorsoap u_soap
soapconnection s_conn
s_conn = create soapconnection

long li_ret
String ls_from, ls_to
double dbl_rate
li_ret = s_conn.createinstance(u_soap,"currencyconvertorsoap")

ls_from = sle_1.text
ls_to    =    sle_2.text

dbl_rate = u_soap.conversionrate(ls_from, ls_to)
messagebox("rate", String(dbl_rate))


Thats it. We have consumed a web service using Proxy wizard.