>>
APLDN Home

>>
Events

>>
Trainings

>>
APL Books

>>
APLDN Links

>>
Discussion Groups

>>
Downloads

>>
Articles

>>
Library

>>
Learning Tools

>>
APLDN User IO

>>
APL2000.com




APL+WebComponent step-by-step example

Posted by on Wednesday, May 19, 2004 (EST)
This article has been Downloaded: 2582 times

This is a step-by-step example of how to create most of the commonly used windows controls, such as Listview, Treeview, etc. in the browser using the APL+WebComponent.

This is a step-by-step example of how to create most of the commonly used windows controls, such as Listview, Treeview, etc. in the browser using the APL+WebComponent

One of the most powerful tools you can have today is the ability to display your application in the browser.  With APL+WebComponent you have the ability to build applications which can be stand alone or published to the web.  The look and feel of your application can be virtually the same.  There is no need to maintain two code bases, as one workspace can be used for both standalone and publishing.  This is possible because with APL+WebComponent. you have []wi available in the browser as well as the APL language.   In APL+WebComponent you will find the tools needed to not only publish your UI, but also to recognize where the code is running, transfer code to and from the server when required, and include Jscript in your APL code to be run in the browser for specialized situations.

Our goal with this example is to provide you with the ability to setup a client/server application using APL+Win, APL+WebServices and APL+WebComponent. 

Start by downloading the example workspace here .  Then follow the steps exactly as they are shown.  That is, unless we have made an error, in that case skip that part and do it correctly :-) 

There is definitely a learning curve to creating a client/server solution using the browser.  Once you are familiar with the process, it is fairly simple, but initially it can be challenging.  For those reasons we strongly suggest that if you are building a solution with a deadline that you contact Lescasse Consulting or APL2000 for help with your first application.

Ok, so here is the recipe!

Download the latest version of APL+WebServices and install. 

Create a server.  In our example, we are going to create a server named aplwcsamp.

We set the ip address to "localhost" and the port to 9090

Choose a public directory (c:\aplwcsamp\public in our case)

Apply these changes and choose OK.

Next, add a new virtual Path.

Since we are using the APL+WebComponent the following is always the same.

 /jsaveservice/service1.asmx

Next we will set the wsid to:

Then set the function to:

Set the rarg to:

The larg to:

Finally, set return to:

We now need to setup the workspace, so we will add a workspace, name it aplwcworkspace with the following parameters:

The server is now setup and ready to accept our requests.

Next Download JsaveSDK.w3

Now Download jsavesdkfiles.zip
In our example we will unzip into the public directory, c:\aplwcsamp\public

Download aplws.w3
Create a copy of your workspace to be published, and copy aplws into that workspace.  
In this case, we are going to publish our workspace named aplwctabs.w3 which you downloaded from the link referenced above.
So, we are going to copy the aplws functions into our aplwctabs workspace, and then save the workspace.

Load the JsaveSDK workspace, the latent expression is Initialize which will bring up the APL+WebComponent creation dialog.

Under the Project menu select Import Workspace and choose your workspace to be published.   This will display all the functions in your workspace in the "Workspace Functions" list control. 

We will now highlight those functions we wish to publish and select the Publish button to the right of the function list.  This will provide us with publishing options, and in our case we have chosen "Debug APL" and Maintain SI Info.

Next choose SaveAs under the File menu.

In our case we saved the project as aplwctabs.wjs

Now we will package our application.  To do this we click the "Package" button and then select 1 for our IO, fm1_Make for our LX, and c:\aplwcsamp\public\aplwcsamp.htm for our filename.  For this project we are leaving the APL Web Services URL empty.

That is it, the workspace is now published. 

We will now go to our browser and enter:

http://localhost:9090/aplwctabs.htm

This will run the function fm1_Make in the browser and instantiate the form.

From this form we can instantiate a number of other forms with various controls such as.

ProgressBars
TrackBars
Listview
Treeviews
Menus
Separators
Buttons
Checkboxes
Spinners 
Combos
Draw Comand on Picture object.

There are two places in our sample which transfers data between the browser and the server.

The first is on the first form which is created.  If you click the "Add values on Server" the function fm1_Hnd is called, which then retrieves the values from the "ed1" and "ed2" text fields and passes them to the "Calculate" function on the server.  The server returns the sum of these two values and the result is placed in the "ed3" text field. 

The second place we go to the server for data is when we populate the listview control.   In the fmDemoListview_Make function we have the line:

t„RunAtServer listviewdata

Which goes to the server, runs the listviewdata function and the result is placed in the variable "t" on the client, which in this case is a heterogeneous matrix used to populate listviews.

Creating a client/server application is relatively simple once you have done a few, but there is definitely a learning curve. 

Some issues which can be troublesome are security issues in the browser, bursting cache in the browser, instantiating controls in the browser when a server side calculation is using 100% of the CPU on the same machine.

 

 

 

 


Bad
Good|Rate Item

Comments:

Step-by-step example
By brent.hildebrand on Saturday, October 16, 2004 (EST)

I have not been able to follow the step-by-step example to completion.  When I get to the step: http://localhost:9090/aplwctabs.htm,  which I actually assume should be http://localhost:9090/aplwcsamp.htm,  I get  a "The page cannot be displayed" error in IE6 with the title bar saying "Cannot find server", and "Loading ..." in Firefox.  I see the "Loading ..." in IE6 briefly just before the "The page cannot be displayed".   In Firefox, I can confirm that the aplwsamp.htm file was loaded as I can see the source data. 

 

I've checked my settings, and I have deleted the webserver, and started over from scratch.  Same results.   I see the aplwcsamp.htm file points to the file blankinit.htm, which is in my public directory.  There is however a form that points to http://localhost:9090/jssave.  This is not handled in the Setup of the webserver.  Is this part of the problem?   From what I can see, my workspace is loaded by not being accessed. 

 

Any suggestions on where to start to resolve my problem?

 

Also in my playing around, I have found some issues with Web Services.  For example using the step-by-step example, for the virtual path /jsaveservice/service1.asmx.  If I right click on "result",  and choose "edit values", strange things happen when using the mouse to edit values.  Assuming everything is correct at the start, double click on a value such as r3, enter a new name such as r4, then click on the r2 row.  r2 will change to r4, the row where you just entered r4 will revert back to r3.    If instead of clicking on r2, you clicked on [new name], you would get an extra row.  Clicking OK saved the data for the result, but then right clicking on result again and choosing Edit Values, will show one less row.  On occation, Web Services would crash when double-clicking  in the manner above, but I can not currently reproduce that.  All the rest is very reproducible.

 

Another issue I have found is in the JSaveSDK workspace.  If you are working on a project that you have already saved, then click on File+Save As, and from the dialog box, select the same name as you are working on, JSaveSDK produces a "FILE TIE ERROR" and suspends in DbAddRecord[8]. 

Reply to this Comment   

Re: Step-by-step example
By Support on Monday, October 18, 2004 (EST)

Your assumption to use aplwcsamp.htm in place of aplwctabs.htm was correct.

In addressing your problem with running the demo, verify the following:

1.  You have the latest JSAVESDKFILES files installed.
2.  c:\aplwcsamp\public contains all the files that are in the parent directory to the TOOLBARS directory.
3.  AplServices ("Web Servers" in APL Web Services Configuration window) is started.
4.  The APLWCSAMP web server is started.

Your two other issues were verified here.  Thanks for reporting them.

APL2000 Support

Reply to this Comment   

Re: Step-by-step example
By brent.hildebrand on Tuesday, October 19, 2004 (EST)

1) I have the latest JSAVE files.

2) "TOOLBARS directory" - - I'm missing something here.  What and/or where is the "TOOLBARS directory".  I do not see this mentioned in the step-by-step example.  I don't have this in my APL+Win setup.  ???

3) WebServices is started, my DIRSERVER is working.

4) APLWCSAMP WebServer is started.

 

I suppose I can setup a wild directory to trap the call for the "page can not be displayed" to see what it was that was not found.

Reply to this Comment   

Re: Step-by-step example
By Support on Tuesday, October 19, 2004 (EST)

The TOOLBARS directory is packaged in the JsaveSDK files that is mentioned in the following step:

>Now Download jsavesdkfiles.zip
>In our example we will unzip into the public directory, c:\aplwcsamp\public

Go to http://apldn.apl2000.com/downloads/APLWC+Downloads/APLWCRC/default.aspx and download the file under
"JsaveSDK files (200,731 bytes)".  Once downloaded, unzip the file and copy all files in the WebPublic folder into c:\aplwcsamp\public.

Hopefully, this solves your problem.

APL2000 Support

Reply to this Comment   

Re: Step-by-step example
By Support on Tuesday, October 19, 2004 (EST)

The TOOLBARS directory is packaged in the JsaveSDK files that is mentioned in the following step:

>Now Download jsavesdkfiles.zip
>In our example we will unzip into the public directory, c:\aplwcsamp\public

Go to http://apldn.apl2000.com/downloads/APLWC+Downloads/APLWCRC/default.aspx and download the file under
"JsaveSDK files (200,731 bytes)".  Once downloaded, unzip the file and copy all files in the WebPublic folder into c:\aplwcsamp\public.

Hopefully, this solves your problem.

APL2000 Support

Reply to this Comment   

Re: Step-by-step example
By brent.hildebrand on Tuesday, October 19, 2004 (EST)
You are right, I was confused by the naming scheme, various files in the download section, and updates. I will run the example again. Thanks!

Reply to this Comment   

Re: step-by-step
By brent.hildebrand on Tuesday, October 19, 2004 (EST)
I think I have the files sorted out, directories populated correctly, but I only get "Loading ..." in both Firefox and IE6. Note before, IE6 gave only an error message. I suspect I am still missing something very simple. As for file names, it would be nice if only the most current files in the release candidate section were posted. It would really be nice if the actual file name where shown in the listings. One listing, "JsaveSDK files (200,731 bytes)", is not the same files as "JsaveSDK files - Version 1.1.1712.zip (77,110 bytes)". But the latter is the same as "Jsave files - Version 1.1.1719.zip (78,290 bytes)" with the last being the latest. Sorry - I'm posting from Firefox and all formatting will be lost... :(

Reply to this Comment   

Re: step-by-step
By Support on Wednesday, October 20, 2004 (EST)
What occurs after the "Loading ..." message?

I want to compare files.  So list the names, dates and sizes for all files in your c:\aplwcsamp folder including any subfolders.

APL2000 Support

Reply to this Comment   

Re: step-by-step
By brent.hildebrand on Wednesday, October 20, 2004 (EST)

I get the "Loading ..." and then nothing more.  I've waited, "a long time".  I do have Java and JavaScript enabled. 

 

I have WebServices running with my DIRSERVER as a server, with its home directory set to c:\aplwcsamp on my C: drive.  You can see it here:

http://waypoint.no-ip.org:7000

 

 

Reply to this Comment   

Re: Step-by-Step
By Support on Wednesday, October 20, 2004 (EST)
The folder labled Toolbars wasn't in your Public folder.  Does it exist?

APL2000 Support

Reply to this Comment   

Re: step-by-step
By brent.hildebrand on Wednesday, October 20, 2004 (EST)
I have a really good explanation. :-) My winzip column showing paths was closed up. So I just dragged and dropped the files. The directory now exsists, but I still have the same issue. I get "Loading ..." and nothing more. What other stupid thing did I do?

Reply to this Comment   

Re: step-by-step
By Support on Wednesday, October 20, 2004 (EST)

The files in your folders match up with the ones here and the example runs here with your copy of aplwcsamp.htm.  Having now ruled them out as possible causes for the problem, lets try something different.  It's possible that your browser is loading the page from the cache containing pages that previously failed to load instead of a new page.  Why not try again, this time bypassing the cache.  In IE (I think) this is done with holding down the Ctrl key when you (re)load the page.  It's worth a try.

APL2000 Support

Reply to this Comment   

Re: step-by-step
By brent.hildebrand on Wednesday, October 20, 2004 (EST)
It is working OK now in IE6. It is not working in Firefox. Firefox shows "Loading ..." and that is it. But IE is working OK now. Thanks.

Reply to this Comment   

Re: step-by-step
By Support on Thursday, October 21, 2004 (EST)
Glad to hear it's finallly working for you in IE6.  What did you do to get it work?

As for the example not working in firefox isn't at all suprising in light of the fact that the APL+Web component is intended to operate in the IE browser.  So your experience may vary with non-IE browsers.

APL2000 Support

Reply to this Comment   

Re: step-by-step
By brent.hildebrand on Thursday, October 21, 2004 (EST)
The final issue was not having the proper directory structure. My error was not "extracting" the files with the directory structure preserved.

Reply to this Comment   

Re: step-by-step
By Support on Thursday, October 21, 2004 (EST)
Okay.  Thanks.

Reply to this Comment   

Add Your Comment



APL2000 Official Web Site

Service is the rent we pay for being. It is the very purpose of life, and not something you do in your spare time.
--- Marion Wright Edelman

APLDN Home   |    |  Events   |  Trainings   |  APL Books   |  APLDN Links   |    |  Discussion Groups   |    |  Downloads   |  Articles   |  Library   |  Learning Tools   |  APLDN User IO   |  APL2000.com   |