Raible's Wiki
Raible Designs AppFuseHomepage- Korean - Chinese - Italian - Japanese QuickStart Guide User Guide Tutorials Other ApplicationsStruts ResumeSecurity Example Struts Menu
Set your name in
UserPreferences
Referenced by
JSPWiki v2.2.33
Hide Menu |
Short example on how to use OpenLaszlo with SOAP / XFire and AppFuseThis 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"
Install the OpenLaszlo war
Exposing the UserManager as WebService
Create a laszlo page
<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>
<soap name="userlist" wsdl="http://localhost:8080/appfuse/services/UserService?wsdl">with the settings of your environment Test your new Laszlo App
Links
|
||||||