Cannot resolve external resource into attachment. Cannot resolve external resource into attachment.

OpenLaszlo on GlassFish

This document describes steps to install OpenLaszlo on GlassFish. It demonstrates a simple web service developed on GlassFish using Netbeans invoked through a front end developed on OpenLaszlo.

About OpenLaszlo

OpenLaszlo is an open source platform for creating zero-install web applications with the user interface capabilities of desktop client software.
OpenLaszlo is write once run everywhere. An OpenLaszlo application developed on one machine will run on all leading Web browsers on all leading desktop operating systems.



Jspwiki style: tabbedSection

tab-Installation

Installation of OpenLaszlo on GlassFish.

The sample has been developed on the latest version of OpenLaszlo (v3.3.3) deployed on GlassFish V1 (9.0 UR1 build 8).

  1. The Laszlo binaries are at Laszlo download page. Download the development kit, specified for any platform. The development kit is a war called openlaszlo-3.3.3.war and it resides atLaszlo war location..
  2. OpenLaszlo.war has dependencies on commons-logging.jar and log4j available from Apache.
    1. Download Log4j-1.2.13 from [ Apache Log4j download page |http://logging.apache.org/site/binindex.cgi]. Unzip the distribution and copy log4j.jar to GlassFish lib directory (install_home/lib directory).
    2. Download commons-logging.jar from Apache commons-logging download page. Unzip and copy commons-logging.jar to GlassFish lib directory.
  3. Start GlassFish
  4. deploy the openlaszlo.war file.
    1. From Admin GUI (usually http://localhost:4848/_) _Applications->Web Applications-> Deploy
  5. Launch the Application. Admin GUI->Applications->Web Applications->Launch. You can run the sample applications that OpenLaszlo bundles, to verify if Laszlo installed successfully.
  6. Develop and run sample application. (Go to the Sample tab on this page)

%%

-Sample

The sample application develops a simple HelloWebService that is deployed on GlassFish. The Web Service Client front end is built using OpenLaszlo library. The front end replicates a functionality currently present in GlassFish that of invoking a Web Service from a test page in Admin GUI. The OpenLaszlo front end invokes the web service and shows the return value in a pop up alert box. The front end also allows us to change the color of the web page.

OpenLaszlo (as we have seen in the installation step) is deployed on GlassFish.

Developing Sample WebService on GlassFish.

  • Download the glassfish-samples package to get a simple web service sample. Install it. Instructions are on the GlassFish Samples Page GlassFish Samples Page
  • Set javaee.home in bp-project/build.properties.
  • Open the hello-jaxws sample under javaee5/webservices/. Glassfish-samples bundles as a Netbeans project (Though for this example you do not need Netbeans).
    • By default, the samples web service is a document oriented web service. To "RPC" enable it, add

@javax.jws.soap.SOAPBinding(style=javax.jws.soap.SOAPBinding.Style.RPC) on the webservice. The code for the web service is shown below:

package endpoint;

import javax.jws.WebService;
import javax.jws.soap.*;

@WebService
@javax.jws.soap.SOAPBinding(style=javax.jws.soap.SOAPBinding.Style.RPC)
public class Hello
{

    public String getHello(String name)
    {
        return "Hello " + name + "!";
    }
}
  • Deploy the web service. Run the following command in the glassfish-samples workspace.
ant compile-deploy-service
    • Go to Admin GUI->Web Services->Hello to test if the web service is deployed successfully.

Deploying the OpenLaszlo Web Service client

  • OpenLaszlo currently does not have an uploader functionality that allows us to upload scripts into OpenLaszlo. Hence we will need to go into the internals of the deployed OpenLaszlo application to deploy the Web Service Client.
  • Download the attached gf-samples.jar file and unjar it under
    glassfish/domains/domain1/applications/j2ee-modules/openlaszlo-3.
  • The gf-samples.jar has a file called webservice.lzx that has the code for the web service OpenLaszlo client. It is not attached here due to wiki formatting issues.
  • Exercise the web service client in a browser window.
    http://localhost:8080/openlaszlo-3/gf-samples/webservice.lzx
  • You can preview the application look and feel under the SnapShot tab.
  • Webservice.lzx first loads a splash screen , it loads up the deployed webservice (you will have to change webservice.lzx to replace dhoom by your host name), invokes the web service and shows the result in a pop up box. Finally it, loads a drop down that allows you to change the color of the web page.

    Jspwiki style: tab

-SnapShot

  • Web Service Client Pre Invoke Snap Shot.

Cannot resolve external resource into attachment.

  • Web Service Client Post Invoke Snap Shot.

Cannot resolve external resource into attachment.


Jspwiki style: tab

%%

Access Count: (org.goodjava.plugin.hitcounter.HitCounter)



laszlo1.png (image/png)
laszlo2.png (image/png)