Raible's Wiki

Raible Designs
Wiki Home
News
Recent Changes

AppFuse

Homepage
  - Korean
  - Chinese
  - Italian
  - Japanese

QuickStart Guide
  - Chinese
  - French
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish
  - Japanese

User Guide
  - Korean
  - Chinese

Tutorials
  - Chinese
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish

FAQ
  - Korean

Latest Downloads

Other Applications

Struts Resume
Security Example
Struts Menu

Set your name in
UserPreferences


Referenced by
Articles




JSPWiki v2.2.33

[RSS]


Hide Menu

AppFuseXFireOpenLaszlo


This is version 2. It is not the current version, and thus it cannot be edited.
[Back to current version]   [Restore this version]


Short example on how to use OpenLaszlo with SOAP / XFire and AppFuse

This is a tech demo showing how to load a list of users via Laszlo/SOAP from a AppFuse application. It contains NO security relevant stuff like authentication.

Download the latest openlaszlo version"

  • Go to http://www.openlaszlo.org/download/ and look for the "Only Servlet" version

Install the OpenLaszlo war

  • Copy the war file in your tomcat webapps directory and start up your tomcat
  • Check, if OpenLaszlo works

Exposing the UserManager as WebService

  • Execute the XFire tutorial (You can find it here)
  • Redeploy your application with the new WebService
  • Check, if the WebService is up and running (e.g. goto http://{yourhost}:{yourport}/{yourappname}/services/UserService?wsdl)

Create a laszlo page

  • Create a page called called userlist.lyx in the openlaszlo webapp folder
  • Add the following content to the file:
<canvas debug="true" height="530">

    <debug x="15" y="15" width="215" height="500" />

	<dataset name="userDset" />
    <soap name="userlist" wsdl="http://localhost:8080/appfuse/services/UserService?wsdl"> <!-- Link to your WebService -->

	<!-- Method to make a document for SOAP message request -->
        <method name="makegetUsersDoc">
        <![CDATA[
            var s =  '<getUsers xmlns="http://service.appfuse.org/" ><User></User></getUsers>';
            Debug.write(s);
            return s;
        ]]>
        </method>


        <method event="onload"><!-- Only debugging -->
            Debug.write('UserList soap service loaded');
            Debug.write('Compare proxy stubs with WSDL SOAP operations.');
            Debug.write('UserList WSDL at ' + this.wsdl);            
            Debug.write('proxy:');
            Debug.inspect(this.proxy);
        </method>

        <method event="onerror" args="error"><!-- Error handling -->
            Debug.write('error:', error);
        </method>

        <method event="ontimeout" args="error"><!-- Timeout handling -->
            Debug.write('timeout:', error);
        </method>
        

 	    <remotecall funcname="getUsers" dataobject="userDset"><!-- Method to load users via SOAP -->
            <param value="${ canvas.userlist.makegetUsersDoc() }" />
                    <method event="ondata" args="value">
			            Debug.write("Got data!");
			            Debug.inspect(userDset);
			        </method>
        </remotecall>
      
     </soap>
    
    <view layout="spacing: 5" >
        <button text="Load users" onclick="canvas.userlist.getUsers.invoke()" />
        <view bgcolor="yellow" layout="axis: y" >
            <view layout="axis: x" >
               <datapath xpath="userDset:/item/getUsersResponse/out/User" pooling="true" /><!-- Some attributes of a User object -->
                <text width="100" datapath="username/text()" clip="true" />
                <text width="100" datapath="firstName/text()" clip="true" />
                <text width="100" datapath="lastName/text()" clip="true" />
                <text width="100" datapath="address/adress/text()" clip="true" />
                <text width="100" datapath="address/city/text()" clip="true" />
                <text width="100" datapath="address/province/text()" clip="true" />
                <text width="100" datapath="address/country/text()" clip="true" />
                <text width="100" datapath="address/postalCode/text()" clip="true" />
            </view>
    </view>
    </view>
    
    

</canvas>
  • Replace the URL in the line
<soap name="userlist" wsdl="http://localhost:8080/appfuse/services/UserService?wsdl">
with the settings of your environment

Test your new Laszlo App

  • Open a browser and go to the new laszlo file (e.g. http://localhost:8080/openlaszlo-3.1.1-servlet/userlist.lyx)
  • In the debug window you can see all methods exposed by the UserService
  • Click on the Load users button to load the users via SOAP ;)


Go to top   More info...   Attach file...
This particular version was published on 06-Nov-2006 13:52:54 MST by MattRaible.