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.
9 comments:
This is very informative and useful to the people who don't much about forte. your expalnation makes it different. keep posting more and tell us bit more about yourself.
Cheers,
Shiva
Hey Srik,
The site is really awsome. Its a kids job to identify that your forte is the forte landuage ;-).
Keep updating the site with much more interesting stuff and be assured of one regular visitor.
- Vijay
Forte is a lot more than just a language, it is all Java with its J2EE wants to be but never will, it's distributed, fast, cleverly designed, not sexy but efficient ... and now dead which I'd like Java to be.
Thank for correcting the error to mention Forte as language, I have updated and made correction.
Srikanth
Any idea where to find Forte 4GL software to install?
You have to contact Sun Micro Systems to get account and then download the software.
Did you work with IBC / IonIdea in Bangalore ?
No, I did not work for either of those companies you mentioned.
To the "Forte 4GL" seeker: alternatively if Sun is quite unwilling to do so. If you happen to have a Sun Ultra Sparc Box you may want to get the complete Solaris 8 edition 2/02 that contains the iPlanet "Sun ONE Integration Server EAI 3.0" which is in fact based on UDS 5.0.1 (Forté)
For the PC edition try to get your hands on a "Sun ONE Starter Kit" dated around Jan 2003 it's on CD4.
Post a Comment