PowerBuilder Authors: Chris Pollach, Yeshim Deniz, Jayaram Krishnaswamy, Kevin Benedict, Avi Rosenthal

Related Topics: PowerBuilder

PowerBuilder: Article

Web Application Development

Using WorkSpace's RAD features to call a Business Process from a Web interface

In my last few articles I have tried to show how to build Business Processes (BPs) and how to use them with PowerBuilder. This article will cover how to build a simple JSF within Sybase WorkSpace to call those BPs. My engineering colleague Jean Choi wrote recently about Web application development, but my aim here is to show you, step-by-step, how easy it is.

Business Processes
I'll use a simple BP from my previous articles (see Figure 1) and my PBDJ Blog (http://ianthain.pbdjmagazine.com) as the process I want to expose via a Web Front End. Even though this is a simple example, don't forget that a Business Process enables the orchestration of events, activities, and other services to perform a vital business process.

How Easy Is It?
In the Enterprise Explorer, right-click on the MyServiceContainer and make sure you can connect to your UnWired Orchestrator, and make sure you have deployed your BP properly by navigating to it under Packages within the Enterprise Explorer. Create a new Web Application Project (File|New|Other) (see Figure 2), then in the New Web Application Project wizard screen, Add Component Support dialog, make sure that JavaServer Faces Support and SOAP Service Support are checked, as our call from the JSF to the BP will be made via SOAP.

Next, in the New Web Application Project wizard screen, Project References dialog, make sure that Servers reference is checked. Click Finish and the WAD project will be created.

Now we should be in the Web Application Development Perspective and we can expand the generated project in the WorkSpace Navigator View. To automatically generate all the Managed Beans we need for our JSF in a RAD way, right-click on deployed BP in the Enterprise Explorer under MyServiceContainer and select the option to Save WSDL (see Figure 3) to the folder \webroot\WEB-INF\wsdl. A WSDL (Web Services Definition Language) document is written in XML and describes a Web service. In addition to specifying the location of the Web service, a WSDL description also specifies the methods provided by the Web service and the messages, datatypes, and communication protocols used by a Web service. Now let's create a basic JSF Web page so we can build a UI. In the WorkSpace Navigator View, right-click on the webroot folder and take the New|Web Page option (see Figure 4).

For our basic example we will keep the template of the page to JavaServerFaces_Basic. Our page will be created and displayed within WorkSpace, allowing us to build it in a RAD way by the process of drag and drop onto a JSF Form from the Palette view, where you see "Drag and Drop Webpage content Here" specified (see Figure 5).

For our example, our simple BP takes one input and returns an output, so we need only place an OutputText , an InputText, and a CommandButton onto the Form from the Palette by drag and drop. The Command button is there for us to call the BP. Once placed, each control property sheet allows you to change certain values such as the CommandButton text to Search (see Figure 6).

Development tools at Sybase are all about ease of use and rapid application development and you've just seen how our engineers have brought drag and drop to building a Web interface. With JSF development, all interaction is processed by Managed Beans and that's another place where you'll benefit from Sybase WorkSpace. Select the Data Bindings Tab and expand so you can see the option Managed Beans | Session, then drag and drop the saved wsdl from the WorkSpace Navigator onto the Session option under Managed Beans. The New Managed Bean Wizard will appear (see Figure 7). In that instant the wsdl has been parsed, allowing the wizard to display the service name and port name, and for you the developer to select the Operation Name that you want to call, from the dropdown of exposed operations in the Business Process. If you leave this empty, by default all operations will be created. Once completed, the Managed Bean Java code has just been generated for you and is now available in the Data Bindings Tab (see Figure 8).

Now we can drag and drop the input from the Managed Bean test within the Data Bindings Tab onto the InputText field, followed by the output from the Managed Bean within the Data Bindings Tab onto the OutputText field. Finally, to call the BP we can drag and drop the method invoke() from the Managed Bean onto the CommandButton. Data Binding to our JSF is now complete...so easy, I'm sure you would agree.

Deploying and Testing
We now need to deploy and test our Web application and we don't even need to leave Sybase WorkSpace, as testing is achieved by right-clicking on the JSP and selecting Run on Server (see Figure 9) and is displayed within a browser page within the Workbench (see Figure 10). This can also be tested outside of WorkSpace in Internet Explorer using the URL http://ithainxp2:8080/BootCamp_WAD/bootcamp.faces.

Now that you have seen how easy and RAD Sybase WorkSpace has made JSF Creation, including its excellent Data Binding capabilities, think about developing a Web front end on a Business Process today!

More Stories By Ian Thain

As one of the Sybase Technical Evangelists, Ian regularly addresses technical audiences all over the world and his sessions are always very well attended. He also writes education classes, whitepapers, demos and articles for various Sybase products and publishes regularly in Journals such as SYS-CON's PBDJ and International Developer Magazine. He is also the Sybase Unwired Platform & PocketBuilder Evangelist and works closely with the team in Dublin, CA and Concord, MA on new features and demonstrations for the products. In his customer-facing Evangelist role, Ian is very involved with the design, production and testing of Enterprise class Unwired Solutions, that have been implemented using Sybase's Unwired tools for Sybase customers around the globe. In addition, Ian is a dedicated technical expert continually working with Sybase's key partners and clients to enhance the capabilities of the Unwired solutions that Sybase can offer to its customers. Ian can also be found on Twitter @ithain

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.