Forte 4GL and Java (Web Services)

Forte 4GL was created as an application server along with a custom language, TOOL (Transactional Object Oriented Language). TOOL only runs on the Forte application server, many users simply refer to their "TOOL" applications as "Forte" applications. This blog is intended for Forte 4GL users. This particular example help to connect their system with Java based client through Web Services.

Sunday, October 22, 2006

Common Pitfalls

Errors I encountered while doing this example.

Please read the 1st post on this Blog to get the overview of communication between Forte and Java through Web Services.

1. I have helloWorld application running on Server and I created my actual Forte Service and I deployed both application with same servers IP Address and port.
So, I was getting error. So I have to bring done my Forte HelloWorldServer and restart my other Forte Service.
2. Naming conversion – Forte is case insensitive and we have given attributes starting with capital letter. And when we deploy Forte generates the java beans (For PersonBO kind of classes). And according to java beans specification you should have attributes names starting with lower case, since java is case sensitive.
I was getting error - Unable to retrieve PropertyDescriptor for property Xxx
So, I have change the attributes on Forte Side and redeploy.
3. If you have Forte Data type like DateTimeData, TextNullable, DoubleData, TextNullable and your methods are using these as attributes. The Forte will fail to generate them as WebService methods.

4. If you try to pass special characters via WebService you will get error. (SOAP Fault; code=SOAP-ENV:Server string=XMLSvr.ProtocolSOAP.getResponseText: Internal Error - no response envelope), Forte WS cannot handle special characters.

Wednesday, August 30, 2006

Web Service Forte 4GL and Java

Hi Friends

I had a requirement to make call to Forte 4GL from Java. So we opted Web Services as solution.
And while doing the “Hello World” kind of application, I found some things and I would share with you all.
In this scenario I had by Forte 4GL as Web Service provider and Java as Web Service Requester.


Step 1 Forte 4GL Code
a. Create a plan – HelloWorldServer
b. Create a non window class called – HelloWorldMgr
c. Create attribute name of type TextData
d. Create a method printHelloWorld() return type of TextData.
Inside the method write the following lines of code.

task.lgr.putline('Hello World called -- Forte Output');
name = 'Srikanth';
return name;


e. Select the class and go to component and select Extended properties and create a new name called “XMLStruct”. All the classes to be exposed as Web Service should have extended property of type “XMLStruct”.
f. Create a Service Object – soHelloWorld, give the class of previously created Class name (HelloWroldServer).

Step 2 (Forte Partition Workshop). Deploy this project as server
a. Partition as Server.
b. Select the Service object, which has to be exposed as Web Service and give the host name port number, where this will be installed, so that later Java Client application can call though this Host and port.
Double click service object in partition workshop and select the Export tab and click on more export options and give the hostname and port.
c. And do make distribution from Partition Workshop.
d. You can do Local and do Full Make.
e. After this step forte will create Java Classes for the Forte Server in your local appdist directory (D:\forte\appdist). Since we said local before.
f. You will see java classes in example:- D:\forte\appdist\5052env1\hellowor\cl0\generic\hellow1\java\com\forte\xmlsvr\helloworldserver
g. Open the Environment Console, Load the new application and Install the new application.
h. Forte Server side is done.

3. Java Client application to call the Forte Web Services.
Call the proxy generated from Forte.
Sample


package com.xxx.yyy;

import com.forte.xmlsvr.helloworldserver.HelloWorldSOProxy;

import com.forte.xmlsvr.providerbo.Provider;

public class HelloWorldMain {

/**

* @param args

*/

public static void main(String[] args) {

HelloWorldSOProxy helloWorldSOProxy = new HelloWorldSOProxy();

try {

String name = helloWorldSOProxy.printHelloWorld();

System.out.println("Java code, return from forte server " + name);

} catch (Exception e) {

e.printStackTrace();

}

}

}


More detail information about this is given in book Integrating with External Systems iPlanet™ Unified Development Server Version 5.0 pages 127 – 156.

Using this as my basis I have build a complete application. This example really help me.

If you have any question on this, Please let me know.