How to implement webservices in Applinx 5.2.5

I am new to Applinx(ver 5.2.5), and need to implement web services in the generated web pages.

  1. Change the particular input field to combo box for a screen.
  2. On selection of particular value in the combo box, open the pop- up window.
  3. On load of the pop-up window, initialize a web service, this web service will return the url for particular screen. URL is generating run time, so can not hard code url. this web-service has already been tested in Struct framework.
  4. open the screen in the Iframe (pop-up window) based on return url.
  5. There will a button on the pop up screen, on click of that button, again call the another web services, and if return values are passed, close the pop-window and save the return value in hidden parameter of the parent screen otherwise show the error message on the pop-up window.

It would great help to me if you provide me sample code to implement above mentioned functionality.

Thank you in advance.

Hello Puneet,

See my answers below each task:

1. Change the particular input field to combo box for a screen.

You need to change the gx:input tag to gx:select tag. See in ApplinX documentation the topic Using Web Application Controls in Generated Pages

2. On selection of particular value in the combo box, open the pop- up window.

In gx:select tag add an attribute onchange and invoke a javascript function that open the window. For handling independent windows see in ApplinX documentation the topic Opening an Independent Pop-up Box that doesn’t have a Corresponding Host Screen

3. On load of the pop-up window, initialize a web service, this web service will return the url for particular screen. URL is generating run time, so can not hard code url. this web-service has already been tested in Struct framework.

To invoke the web service you need to first create a web service client based on the web service WSDL. For example in Eclipse you can create the client using a wizard available in the top menu file → new → other → web service client.
Than you need to invoke the web service in the java code of the popup page in gx_onload function.

4. open the screen in the Iframe (pop-up window) based on return url.

There are several ways of how to move a parameter from server side to client side. In this example I’ll use hidden field.

First of all add an hidden input field with the URL that you got from the web service getTagsAccesor().AddHiddenFieldToForm(“HiddenFieldName”, “Your URL”);

After that you need to load the iframe (src) with the URL from the hidden field in the onload event of the browser using java script.
In ApplinX framework you should use the javascript function pageOnLoad()

5. There will a button on the pop up screen, on click of that button, again call the another web services, and if return values are passed, close the pop-window and save the return value in hidden parameter of the parent screen otherwise show the error message on the pop-up window.

For creating the button please look at the topic Creating a Button / Hyperlink for Executing a Path Procedure. Instead of the code to execute a path, invoke your web service and based on the answer you should call “getGXWindow().close();” to close the window.
To return a value to the opener screen you should call getGXWindow().getOpenerWindow().setField(“”, “”);
The field in the opener should be a gx tag based field like <gx:input type=“text” id=“value_from_window”/>

Hope it helps

Regards,
Assaf