0% found this document useful (0 votes)
12 views

Usage of Java In Siebel Part 2

Uploaded by

sara Hosseinjani
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Usage of Java In Siebel Part 2

Uploaded by

sara Hosseinjani
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Usage of Java in Siebel

Part 2

Prepared By Moslem Ghalandari Date 2022-09-21

Review Sarah Hosseinjani Date 2022-09-22

1|Page
Table of Contents
1- Steps to implement a JBS .......................................................................................................... 3
2- Example of a Java Business Service: ......................................................................................... 6
3- Final thoughts: .......................................................................................................................... 7

2|Page
1- Steps to implement a JBS

Solution overview:
1) Setup the java subsystem
2) Implement a specialized eScript BS
3) Build a Java Class
4) Implement the program logic in Java

Setup the Java Subsystem:


This is the easiest part. Go to your Client CFG file and create the following
section:

[JAVA]

DLL = <Program path>\jvm.dll

CLASSPATH = <Siebel Tools path>\CLASSES\Siebel.jar;<Siebel Tools path>\CLASSES\ImposSiebelXSLT.jar

VMOPTIONS = -Xrs -Djava.compiler=NONE

This can also be implemented as a Server profile configuration, see bookshelf


for more information, but most developers will want to try this out on the local
machine.

eScript BS:
1. Create a BS based on the class: "CSSJavaBusinessService"
2. Call it "ImposSiebelXSLT Business Service"
3. Create a BS user property with the following values

Name: @class
Value:ImposSiebelXSLT

This BS will be barebones and just pass the method down into the Java class,
where the real work will happen

3|Page
Java Class:
1.Create a new project of type "Java Class Library" called "ImposSiebelXSLT"
2.Link the Siebel.jar file to your project libraries
3.Create a new class called "ImposSiebelXSLT"
4.Add the following code to import the required Clases

import com.siebel.data.SiebelPropertySet;

import com.siebel.eai.SiebelBusinessServiceException;

import java.io.*;

import javax.xml.transform.stream.*;

import javax.xml.transform.*;

5. Add the following code to inherit from the Siebel Business Service class

ImposSiebelXSLT extends com.siebel.eai.SiebelBusinessService {

public void doInvokeMethod(String methodName, SiebelPropertySet input,

SiebelPropertySet output) throws SiebelBusinessServiceException {

4|Page
6. Add the following code to perform the XSLT transformation

StreamSource xmlSource = new StreamSource(new StringReader(input.getValu


e()));

StreamSource xsltSource = new StreamSource(new StringReader(input.g


etProperty("XSLTBuffer")));

Writer outWriter = new StringWriter();

StreamResult result = new StreamResult( outWriter );

TransformerFactory transFact = TransformerFactory.newInstance();

javax.xml.transform.Transformer trans;

trans = transFact.newTransformer(xsltSource);

trans.transform(xmlSource, result);

output.setValue(result.getWriter().toString());

output.setProperty("ErrorMessage", ErrMsg);

7. Compile and place the Jar file into your class path as defined in your
configuration file above.

Usage:
Now we can call the JBS like any other eScript business service, by passing in
input and output property sets.

5|Page
BS:ImposSiebelXSLTBusinessService

[InputProperty]
<Value>:XMLString
XSLTBuffer:XSLTString

[OutputProperty]
<Value>:Transformed XML String

2- Example of a Java Business Service:

package com.example.jbs;

import com.siebel.data.SiebelPropertySet;

import com.siebel.eai.SiebelBusinessServiceException;
public class AddBusinessService extends com.siebel.eai.SiebelBusinessService {

public void doInvokeMethod(String methodName, SiebelPropertySet input,


SiebelPropertySet output) throws SiebelBusinessServiceException {
String X = input.getProperty("X");
String Y = input.getProperty("Y");

if (X == null || X.equals("") || (Y == null) || Y.equals(""))

throw new SiebelBusinessServiceException("NO_PAR", "Missing param");

if (!methodName.equals ("Add"))

throw new SiebelBusinessServiceException("NO_SUCH_METHOD�?, "No


such method");
else {

int x = 0;

6|Page
int y = 0;

try {

x = Integer.parseInt(X);

y = Integer.parseInt(Y);

}
catch (NumberFormatException e) {

throw new SiebelBusinessServiceException("NOT_INT", "Noninteger


passed");

int z = x + y;
output.setProperty("Z", new Integer(z).toString());
}

}}

3- Final thoughts:
Taking the leap into JBS and using an entirely new XSLT parser can be a risky
undertaking, it means that your entire application needs to be regression tested.
This is the same problem Siebel would have to face, if it replace its XSLT
engine.
So what should we do?
If you dont have any problems with your "EAI XSLT Service", it is best to leave
it alone.
JBS's arent the solution to everything, but it provides a door to the open source
community.

7|Page

You might also like