Switch to standard view 
  Sybase logo

EAServer Code Samples and Utilities

There are over 65 EAServer samples available in the Sybase Developer Network. Topics include Web Services, SOAP, SSL, J2ME, EJB, JSP, MDB, JMS, PowerBuilder, Jakarta Ant, Apache Tomcat and Axis, XPath, WAP, Struts, JAXP, JAAS, JMS, JNDI, memory tuning, and more.

Access the EAServer samples codeXchange project on the Sybase Developer Network: EAServer technique and code samples. If you have samples to share, please submit them in the project.

Following is a list of samples included. For the most current lists, please see full list of project samples, samples by category , or popular samples

Sample Description
Apache Axis to Deploy PB8 component and call from Java Client or PocketSOAP from PB8 client Explains how to use Apache Axis to deploy a PowerBuilder 8 calculator component running on Sybase EAServer as a Web service. Also covers how to invoke web services from a PowerBuilder 8 client, using the PocketSOAP SOAP client COM component.

Apache Axis to Deploy PB9 component and call from JSP A PBDJ article and code sample by Bruce Armstrong. Covers how to use Apache Axis to deploy a PowerBuilder 9 newsgroup search component running on Sybase EAServer as a Web service, and call it from a JSP.

Apache SOAP 2.2 with Sybase EAServer

Instructions to get EAServer 4.0 or 3.6.1 installation up and running with Apache SOAP 2.2
Apache Tomcat with EAServer Although EAServer is a J2EE application server designed to host both Web Components and Enterprise Java Beans, some users may wish to use the Apache Tomcat engine as a Web Container, and delegate just the EJB requests to EAServer. In this white paper and code sample, we show you how to achieve just that.

Authentication Service Demo Includes a Java component to demonstrate EAServer's support for user configurable authentication service, and how it can be customized to suit the security policy of the user environment

Authentication via JAAS and JDBC Connection

Demonstrates how to use JAAS (Java Authentication and Authorization Service) to authenticate our users against a database via a JDBC connection. (For jagadmin it authenticates against EAServer). It is quite easy to replace the user authentication piece with your own (or blank it out to give everyone access).

Authorization Service In this sample, the Java component writes authorization information, including session, user, and role information to the Jaguar server log, then allows access to proceed. The authorization component is invoked for a PowerBuilder component, which is called from a PowerBuilder client application.

ClickStream for Tracking Users in EAServer Example uses ClickStream and EAServer 4.1. By knowing how visitors use your Web site, what pages they visit, and in what order, you can customize Web site content for each user or improve on your site's navigation.

ClientSSL Contains two sample Java applications that useSSL connections to EAServer, and an example SSL callback implementation. Includes a simple client to print SSL session info, a utility class to print proxy SSL settings, a client that allows the user to choose required security options as needed

CORBA Intro Contains a Java applet that uses EAServer's Java ORB to instantiate a component and execute its methods.

Custom Tag Library This sample provides a Custom Tag Library (CTL) to invoke EAServer components. The CTL handles (or hides) the required logic behind the scenes, allowing different types of component calls to be called genericallt from JSP. The JSP uses the CTL to invoke an EJB component via JNDI, and a PB component via CORBA
EAServer Message Service with PowerBuilder Provides an example showing how the EAServer MessageService can be used together with a PowerBuilder 8 or 9 application.

EAStarter Kit - PowerBuilder to Web samples A small application demonstrates how to use PB to create Web applications in EAServer. Provide ideas for PB developers moving to Web or N-Tier architectures, demonstrates how easy it can be done

EAServer Debug Utility EASDebug is a simple script to turn on/off EAServer debug settings using jagtool

EAServer Integrator Utility (EASi) EASi provides a simple, unique, elegant, code-free and complete solution that would allow EAServer to communicate with existing and established application servers that already contain rich beds of business logic. Through the use of EASi, EAServer can invoke existing components deployed on other vendor's application servers.

EJB 2.0 Container Managed Persistence This sample defines two components to demonstrate the use of container managed persistence for entity beans, including EJB-QL queries for finder and select methods. This sample also shows the use of local interfaces.

Error Handling in EAServer Components and Applications See Chapter 4 of the EAServer Troubleshooting Guide for several code samples that demonstrate techniques for handling exceptions in Java CORBA components, CORBA C++ components, and JSP pages.

Flush Static Page Cache

This is a simple Java client program that connects to EAServer and flushes the static page cache, using the flushStaticPageCache method of the Jaguar/Management interface.

FTP Client Utility

This Web application uses the Apache Jakarta Net components to implement a Web based FTP client.

Getting Started with EAServer, PowerBuilder and JSP Includes a PBL and JSP along with a tutorial to will walk you through the setup of EAServer and bringing your first DataWindow to Web.
Google Search Web Service with PowerBuilder 9 JSPs

Steps you through creation of Java Server Page to access the Google™ Web APIs service from a Java Server Page built with PowerBuilder 9, deployed to a J2EE server such as EAServer.

J2EE application - My Portfolio stock trading simulation Web application simulates an online stock trading service. JSPs provide the user interface. The JSPs call EJB session beans for client session management, and the session beans call EJB entity beans to manage data in the back-end database. The application uses Message Driven Beans (MDBs) and the Java Message Service (JMS) API to create alert messages in response to stock price changes

J2EE PetStore 1.3 on EAServer 4.1 The Petstore 1.3 application conforms to the J2EE 1.3 spec. This version of the Petstore application makes use of the new features like JMS and servlet filters, and EJB container managed persistance (cmp 2.0). The successful deployment of the Java PetStore 1.3 application clearly indicates EAServer's ability to implement the new features included in the J2EE 1.3 spec and the ability to conform to the spec.

J2ME Toolit and Smart Ticket demo with EAServer Configuration and deployment of the Sun J2ME Wireless Toolkit and Sun Smart Ticket demo application to EAServer. Smart Ticket allows users to buy movie tickets through a mobile device. Customers can sign into the application; browse a personalized list of movies, theaters and showtimes; and purchase seats for a particular show.
JAAS in EAServer Demonstrates the use of JAAS APIs and LoginModule in a Java client application for user authentication.

Jagtool and Jagant for Automated Development and Deployment

Contains a a sample build file that shows how jagtool commands can be used with Jakarta Ant.
Jaguar Agent for Web Services (JAWS) JAWS is a servlet that allows Web clients to invoke methods of PowerBuilder custom class user (nonvisual) objects running in EAServer. It provides a natural migration path for Web.PB applications, and a mechanism for Jaguar components written in other languages such as Java or C++ to return Web content to a browser.

Jaguar Cookie Monster This utility is a Jaguar service that eats old cookies, keeping your Jaguar repository to a manageable size. Every time the Jaguar server is restarted, the CookieMonster browses the repository to find PowerBuilder components, then "eats" outdated cookies that are unnecessarily taking up space.

Java Performance Monitoring API (JAMon)

A free, simple, high performance, thread safe, Java API that allows developers to easily monitor production applications. JAMon can be used to determine application performance bottlenecks, user/application interactions, and application scalability. JAMon gathers summary statistics such as hits, execution times (total, average, minimum, maximum, standard deviation), and simultaneous application requests.

JavaServer Pages: Tag Libraries vs. JavaBeans

This sample contains a small, simple example of using both JavaBeans and custom tags inside of a JSP page.
JAXP: Coding for Parser and Transformer Independence Article and code sample for JAXP, the API for XML Processing. EAServer has included support for JAXP since version 3.6.1.

Java Message Service (JMS) in EAServer Get up and running with JMS and EAServer in approximately 15 minutes. Configure and run the JMS equivalent of a basic "Hello World" point-to-point messaging solution. Moving to topic-based messaging from there is a logical and easy step.

JBuilder JSP for EAServer ResultSet Create JSP in JBuilder to Retrieve ResultSet from EAServer Connection Cache
JBuilder Samples for EAServer Plugin How to deploy and remotely debug a session EJB, deploy and invoke a servlet, deploy a JSP to invoke session bean method

JNDI utility for EAServer's JagTool Includes the JagTool version of the Java Naming and Directory Interface (JNDI) utility. The jagtool ejb_binding command shows the JNDI binding for EJBs found in a package

JMX MBean Service Builder SimpleMBean extends com.sybase.management.jmx.services.ServiceSupport, a Sybase-provided abstract class, which you can use to build services for EAServer 5.0.

JMX Log Monitor
Obtains an RMI connection to the JMX MBeanServer, and monitors the contents of the EAServer error log, checking for a string that, if seen, triggers a server restart, using the service interface exposed over JMX.
JMX Notification Listener Obtains an RMI connection to the JMX MBeanServer, and listens for JMX notifications generated by the ServicesManager MBean, which are sent whenever a service MBean changes state, or an operation is performed on it. For example, if EAServer is shut down (or crashes), this generates events that are picked up by the sample.
JSP uses ResultSet from EAServer Connection Cache JSP that uses EAServer connection cache to get a ResultSet from the jagdemo database, an output an HTML table with the data.

LDAP with EAServer and PB 8.0 This example application uses a PowerBuilder client that will connect to an EJB running on EAServer that will then connect to an LDAP (Lightweight Directory Access Protocol) server

Log4J for EAServer

Open source for Log4J logging in EAServer

Memory Check/Dump/Trace from Java component Java component utilizes memory method of the Jaguar/Management interface to check, dump, or trace memory
Lomboz plugin to Eclipse This EAServer file for Lomboz plugin to Eclipse allows you to use Eclipse environment for J2EE development, and deployment to EAServer.
Memory Debug/Dump/Trace from PB PowerBuilder application utilizes PbHeap API calls to enable memory tracing, debugging, and dump memory on demand or at specified intervals

Memory Dump Analyzer Utility This is a utility to read a log file in which one or more SybHeap or PbHeap memory dumps are present, and produce a heap summary for each dump. Also produces a "possible leak" summary for each adjacent pair of dumps.
Message-Driven Beans and JMS Shows how to run message-driven beans (MDBs) and use the Java Message Service (JMS) in EAServer. Includes a client and an MDB. The client sends a message to a queue that the MDB that is listening on. The MDB will receive the message and send a message to a queue for the client to receive

Message Monitoring Console Real time updating console, to monitor messages currently traveling through the EAServer Message System. It also provides an example of how to use the open API's that Sybase EAServer uses for all of it's management systems

Monitoring Components Statistics This program captures the component statistics for a running EAServer server. The output is generated as a CSV file, suitable for import into a spreadsheet. The output includes one line for each component, with call count, active instances, pooled instances.
Monitoring CMP Component Statistics This program extracts CMP statistics from an EAServer log file, and generates output files suitable for import into a spreadsheet. The program can easily be adapted to extract log entries with any desired prefix and write them to a different file for easy viewing and analysis.
PowerBuilder project samples

Additional EAServer samples are available in the PB / EAServer folder in the PowerBuilder codeXchange project.

PowerBuilder XML Generator The PB XML Generator provides developers with the ability to export existing PB 7.x and 8.x DataWindows as XML documents through a simple JSP tag library and EAServer components. Tag attribute values are specified through an HTML form and JSP or servlet, allowing the user to customize the DataWindow export to XML.

Redirecting Reports To Different Printers In EAServer On Solaris Script and guidelines for printing DataWindow/Datastore objects produced by PowerBuilder components running on EAServer on the Solaris platform.
Security Demo - C++ version Contains a Java applet and a C++ component that demonstrate Jaguar's SSL support. The C++ component uses Jaguar's built-in CtsSecurity/UserCredentials component to determine the SSL username and other SSL connection properties. The applet calls the sample component and displays the results.

Security Demo - Java version Contains a Java applet and a Java component that demonstrate Jaguar's SSL support. The Java component uses Jaguar's built-in CtsSecurity/UserCredentials component to determine the SSL username and other SSL connection properties. The applet calls the sample component and displays the results.

Servlet to Read EAServer Log Files

This utility -- LogReader -- allows you to read EAServer log files with a browser using a Servlet. You choose the log file you want to view from a menu. The log file will be positioned at the end of the page so you can see the last messages written. By simply reloading or refreshing the page you get an updated view of the log.

Simulating Server Push in PB and EAServer A client application cannot pass a PowerBuilder object reference to EAServer. But, this behaviour can be simulated by using a shared object on the client to communicate with EAServer. To simulate server push, the client uses the SharedObjectRegister and SharedObjectGet functions to create a shared object. Once the object has been created, the main thread on the client makes an asynchronous call to a method on the shared object, passing it a callback object that should be notified when processing has finished on the server. The method on the shared object makes a synchronous call to the EAServer component method that performs processing

SOAP Development with PowerJ 4.0 and PowerBuilder 8.0 Whitepaper provides an introduction to SOAP, with corresponding code examples including a PowerBuilder component to use as a Web Service in EAServer, and a Java SOAP client.

SOAP sample application - Canine Shelter For EAServer 4.1 and 4.2. Demonstrates how a client application would use the Sybase ClientProxy to construct and send a SOAP request to an EAServer server. The ClientProxy hides all the details of SOAP processing and HTTP and HTTPS transport, allowing the client programmer to concentrate on client business process. The sample application is a Canine Shelter search that sends a SOAP request for dog records that contain information matching the search criteria entered by the user.

TabularResults open source The TabularResults package is designed as a CORBA & Java Serializable ResultSet holder. It allows the entire result set to be tored in memory (so the connection to the DB can be closed), and the results can be transmitted by Serialization or CORBA marshalling.

WAP using Struts, iAWS, and EAServer This sample includes an introduction to WAP (Wireless Application Protocol), which is is based on WML (Wireless Markup Language). The paper steps through several options for creating WAP applications. It covers the use of Struts and Servlets in EAServer, PowerJ, and iAWS ( iAnywhere Wireless Server).

Web DataWindow hosted by EAServer in ASP Code sample and step-by-step instructions for installing and testing the Web DataWindow in ASP / EAServer environments

WebDataWindow in ASP or MTS Sample web page, and instructions for installing and testing the Web DataWindow (WebDW) in either ASP or MTS environments

Web DataWindows with JSPs Using Custom Tags This paper outlines the steps needed to create a custom JSP tag extension to handle a DataWindow object. A completed example is provided as a PowerJ project.

Web Services ANT Scripts EAServer 5.0 sample to walk you through using wstool commands in the ant build file to deploy a Web service, manage it, retrieve information about it, and run a client to invoke operations on it.
Web Service CORBA Component EAServer 5.0 sample to step you through exposing a stateless CORBA component as a Web Service

Web Services dot Net Client (EAServer 5 version) EAServer 5.0 sample to install and expose a Web service then create a .NET client to invoke the Web service.

Web Service dot Net Sample (EAServer 4 version) Shows a simple example for .NET Interoperablity in the Web Services Toolkit. Covers deployment of the stateless bean in an EJB jar, WSDL file generation, creating the client side proxy, building a .NET client, and running the C# .NET client

Web Services Dynamic Client EAServer 5.0 sample to invoke a web service without requiring any client side artifacts be generated. The client knows the name of the method to invoke, the details about the method being invoked

Web Service EJB Component EAServer 5.0 sample to expose a stateless session EJB as a Web then invoke it from a JSP client

Web Service Java Class and Client EAServer 5.0 sample to invoke a web service without requiring any client side artifacts be generated. The client knows the name of the method to invoke, the details about the method being invoked

Web Service with PB Component and Client (EAServer 4 version) Steps you through creation and deployment of a PB component, using the EAServer Web Services Toolkit to automatically generate the WSDL, creating the proxy from PowerBuilder, and creating a PB client to invoke the Web service

Web Service with PowerBuilder Component and Client (EAServer 5 version) Sample illustrates how to use a PowerBuilder 9 component as a Web service hosted in EAServer 5, and use a PowerBuilder 9 client to call the Web service

Web Service with PB Generated JSP (EAServer 4 version) Tutorial steps you through PowerBuilder to create a JSP Web service application, including a 4GL JSP page, that you deploy to EAServer 4

Web Service with JAX-RPC Interfaces EAServer 5.0 sample that demonstrates how to develop, deploy and run a Web service that conforms to JAX-RPC specification

Web Service with Security Authorization Checks EAServer 5.0 sample that shows how a Web service could enforce authorization checks on the operations

Web Services in EAServer 5 with Google Search Service Provides the steps needed to access the Google™ Web APIs service from the EAServer 5 Web Services Toolkit. By just pointing to the service WSDL file, you can use the EAServer Wizards to automatically create the files needed to invoke the web service operations from EAServer, and to create a Java test client as well

XPath to Navigate XML Documents Sample and whitepaper shows how to use the XPathAPI.java class that ships with Apache Xalan to navigate XML documents using XPath. The class exposes methods that allow you to issue XPath statement(s) against an XML document, returning a NodeIterator that can be used to iterate through the matches. Furthermore, you can arbitrarily grab DOM Nodes from the iterator that can then be used to further drill down into the XML, if desired


Back to Top
© Copyright 2010, Sybase Inc.