Creating a Web Services Server using Borland JBuilder 2006 Enterprise for consumption with Borland Developer Studio 2006

Abstract: Creating a Web Services Server using Borland JBuilder 2006 Enterprise for consumption with Borland Developer Studio 2006

  • Product Name: Borland Developer Studio 2006, Borland JBuilder 2006 Enterprise
  • Product Component: N/A
  • Platform/OS Version: Windows


This article shows how to create a�JBuilder 2006 Enterprise Web Services�application and consume it from Borland Developer Studio 2006.


1. Create a new JBuilder 2006 project using File, New Project with default settings in the Project Wizard dialog and click Finish. (Assumes Tomcat 4.1 and 5.5 is installed).

2. Create a new Java class using File, New Class, and set the Class name and package name appropriately, ie, Class Name: WSLesson, Package: WebServices.

3. Code all required Web Services functions into the new class, for example, by declaring the function GetPasswordHash which takes a string as a parameter and returns a string, with the following code.

public String GetPasswordHash(String Password) throws� { LHashAlgorithm ="SHA1");
byte[] LBuffer = Password.getBytes();
byte[] LDigestBuffer = LHashAlgorithm.digest();
String LDigest = new sun.misc.BASE64Encoder().encode(LDigestBuffer);
return LDigest;


4. Right click on the completed class and select Export as Web Service. In the Module Chooser Wizard, select Create web services module and click Ok.

5. In the Axis Web Services Server Configuration Wizard, click on New to create a new Web module, click on Create empty Web Module (WebModule1), click Next, and click Finish, and click Finish.

6. Run the project.

7. Using a web browser, browse http://localhost:8080/WebModule1/services/WSLesson?wsdl. (this URL is dependant on the configuration of your server configuration in the JBuilder IDE�s Enterprise Setup menu)

8. Save the resultant wsdl into a file,�eg�at C:\temp\WSLesson.wsdl.

9. In BDS 2006, create a new VCL Forms Application using File, New, VCL Forms Application � Delphi for Win32.

10. Drop a TLabel, a TEdit, a TButton and a THTTPRIO onto the main form.

11. Import the WSDL file using File, New, Other, WebServices, WSDL Importer, and specify the file you've saved, eg, C:\temp\WSLesson.wsdl as Location of WSDL file, and click Finish, and Finish again, which creates the WSLesson1 unit for the newly imported web services.

12. Double click on the TButton to create an event to handle the button click.

13. Add the WSLesson1 unit to the implementation uses clause of the main form.

14. Obtain an instance of the webservices, by calling GetXXXXX (where XXXX is the name of your web services class) and invoke it by calling the function you desire, or add/replace the following code into the button click's event code (if you're following the above example so far).


LHash: string;
LWSLesson: WSLesson;


LWSLesson := GetWSLesson(true, '', HTTPRIO1);
LHash := LWSLesson.GetPasswordHash(Edit1.Text);
Label1.Caption := LHash;


15. Run the application, enter �secret� without the quotes into the TEdit, and click on the button.

16. If there are no configuration errors, the string �5en6G6MezRroT3XKqkdPOmY/BfQ=� (without the quotes) will show up in the label.