Welcome!

PowerBuilder Authors: Dan Joe Barry, Ian Thain, Yakov Werde, Paul Slater, Bruce Armstrong

Related Topics: PowerBuilder

PowerBuilder: Article

Service Development in WorkSpace

The beauties of not writing code

Note that if we wanted to we could use the Database Tooling in WorkSpace to manage the database and perhaps create new stored procedures if they weren't there already.

Having decided to create a service that uses more than one stored procedure, we select the connection profile, bring up the context menu, and choose 'Create Database Service.'

Skipping some of the mundane details of file creation, this gets us to the method selection page where we decide which stored procedures we want to expose in our service.

Note that this is just an initial list; we can always change our minds later on and choose to unexposed some of the operations we choose now and expose some we didn't. So, all that's left to do is hit 'Finish':

The service is created for us, automatically adding those three operations we chose, including all their input and output parameters. We can now choose to expose that service as a Web Service when we deploy it or invoke it from other services (or both, of course). Most commonly one would choose to expose this as a Web Service (exposing it using a SOAP protocol over an HTTP transport), but one could also, or even additionally, chose an XML protocol over a JMS or E-Mail or File messaging transport. Depending on the service type and definition, one could also use a Custom Wire Format protocol as well. Choosing the transport(s) and protocol(s) you want to expose a service over is very simple, simply specify a few details, at most, about the transport(s) and select the protocol(s) to use. In a span of less than five minutes, you can expose your database's stored procedures (and the SQL statements run on your database, which I haven't shown here) either internally, externally, or both, all with no coding required.

A (Mildly) Complex Example:
Creating a Java Service in WorkSpace
So far, so good, but at this point all we've done is expose existing functionality, we haven't actually written any new business logic yet. So let's try writing a simple calculator service in Java. When creating a Java service, you can either start with an existing implementation or create a new one from scratch. For purposes of this example, we'll create it from scratch. Again, skipping over the boring obvious parts, we create a new Java service that points at a new Java file, com.sybase.pbdj.test.Calculator:

The interface and implementation are at this point empty, so we'll need to add a new operation. There are two ways of doing this, either by adding a new method to the source (either on the Source page or by editing the .java file in a separate editor) or by adding a new method to the implementation. Since it's faster, we'll add it on the Source page:


More Stories By David Brandow

David Brandow, a software engineer at Sybase, Inc., has been been a key developer on Power++, PowerJ, EAServer, WorkSpace and SUP. David obtained a BMath from the University of Waterloo.

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.