Bss V Wrapper For Function Beebe 852
Bss V Wrapper For Function Beebe 852
Customizing EnterpriseOne
December 2013
Business services is quickly becoming the preferred method of interfacing between third-party applications
and JD Edwards EnterpriseOne. Using business services you can expose web services functions to the
outside world to give other applications an industry standard method to interact with E1. Business service
functions also give you the opportunity to call third-party web services. Web services is becoming the
standard method for unrelated applications to interact with each other. In E1, business services is used to
publish and consume web services.
This article was written with the intent of providing you with a Hello World type of exercise to help you learn
how to build your first business service function. This example will walk you through creating a business
service function that will simply call an EnterpriseOne function. I call this a wrapper since it provides no other
functionality beyond just calling the function. The wrapper business service can then be published, allowing
an outside application to call your E1 business function.
Before starting this exercise, create a simple business function that takes an address number for an input
and returns basic address book info: Alpha Name, Address Line 1, Address Line 2, City, State, Zip, Date
Last updated, Time Last updated. This business function includes all the common data types that we will
normally deal with. The instructions below are the steps required to build a business services wrapper for
this function.
This document assumes that business services are properly setup on E1 development workstation. If trying
to walk through for a training exercise, you will need to change object and class names from this example.
JP550001
Description
oracle.e1.bssv
Product Code
55
55
Source Language
BSSV
Object Name
J550001
Description
Package Prefix
oracle.e1.bssv
Product Code
55
55
Source Language
BSSV
In OMW select J550001, click on the design button on the middle toolbar.
Click on the Invoke JDeveloper button.
When JDeveloper starts it will prompt to save selected files. This is normal; just click OK.
Page 2
4.
Create a new project to work with the new files we are creating. Right click on DV900 in the tree
view in the workspace pane, select New EnterpriseOne Project.
5.
If you dont see the next screen, just click on Next to get to it. Enter J550001 in the object name
field, click Find. Select J550001 in the grid, click on Finish. If prompted to override the existing
project file, click on Yes.
Page 3
Create the Value Object Class Based on BSFN Data Structure: Internal for
J550001
These value object classes are used as data structures to pass data to/from the business service functions.
1.
Find the new J550001 project in the tree view in the workspace pane on the right. Right click on the
J550001 project and select New from the popup menu.
Page 4
2.
In the tree view on the left, click on Classes under EnterpriseOne. Select Business Function Value
Object Class in the list on the right. Click on OK.
Page 5
4.
Enter N550001 in the Object Name field, click on Find. Select the GetABInfo function in the grid,
click Next.
5.
This screen shows all of the elements from the data structure for the GetABInfo function. Since we
want to use all of the elements, select all of them. Click on Select All.
Page 6
6.
Give the value object a name and select Scope. This value object will not be published; it will only
be accessible to other functions on the BSSV server.
a. Enter InternalGetABInfo for the name.
b. Set Scope to be Internal.
7.
JDeveloper creates the new value object class based on the data structure members that you
selected. If you look at the file you will see each of the members defined in the class. You will
notice that all of them have been declared as private. That means they can only be accessed from
within the class itself. Standard practice is to make these elements private and then create public
functions that can be used to GET and SET these values. JDeveloper makes this easy.
a. Right click in the code page. Select Generate Accessors from the popup menu.
Page 7
Select all of the data members in the Generate Accessors screen. Click OK.
Create a new project to work with the new files we are creating. Right click on DV900 in the tree
view in the workspace pane, select New EnterpriseOne Project.
Page 8
2.
If you dont see the next screen, just click on Next to get to it. Enter JP550001 in the object name
field, click Find. Select JP550001 in the grid, click on Finish. If prompted to override the existing
project file, click on Yes.
Page 9
Find the new JP550001 project in the tree view in the work space pane on the right. Right click on
the JP550001 project and select New from the pop up menu.
2.
In the tree view on the left, click on Classes under EnterpriseOne. Select Business Function Value
Object Class in the list on the right. Click on OK.
Page 10
3.
4.
Enter N550001 in the Object Name field, click on Find. Select the GetABInfo function in the grid,
click Next.
Page 11
5.
This screen shows all of the elements from the data structure for the GetABInfo function. Only
select the data members that will allow input into the function. In our case only the address book
number is an input parameter.
a. Click on the check box next to mnAddressNumber.
6.
Give the value object a name and select Scope. This value object will be published.
a. Enter GetABInfo for the name.
b. Set Scope to be Publish.
Page 12
7.
JDeveloper creates the new value object class based on the data structure members that you
selected. If you look at the file you will see each of the members defined in the class. You will
notice that all of them have been declared as private. That means they can only be accessed from
within the class itself. Standard practice is to make these elements private and then create public
functions that can be used to GET and SET these values. JDeveloper makes this easy.
a. Right click in the code page. Select Generate Accessors from the popup menu.
b. Select all of the data members in the Generate Accessors screen. Click OK.
Page 13
Find the new JP550001 project in the tree view in the work space pane on the right. Right click on
the JP550001 project and select New from the pop up menu.
Page 14
2.
In the tree view on the left click on Classes under EnterpriseOne. Select Business Function Value
Object Class in the list on the right. Click on OK.
Page 15
4.
Enter N550001 in the Object Name field, click on Find. Select the GetABInfo function in the grid,
click Next.
5.
This screen shows all of the elements from the data structure for the GetABInfo function. Only
select the data members that will return values. In our case all but the Address number will be
output parameters.
a. Click Select All.
b. Deselect mnAddressNumber.
Page 16
6.
Give the value object a name and select Scope. This value object will be published.
a. Enter ReturnABInfo for the name.
b. Set Scope to be Publish.
7.
JDeveloper creates the new value object class based on the data structure members that you
selected. If you look at the file you will see each of the members defined in the class. You will
notice that all of them have been declared as private. That means they can only be accessed from
Page 17
8.
The superclass for the two value object classes we just created need to be changed from
ValueObject to MessageValueObject. MessageValueObject is the typical value object superclass
for output value objects. It includes an E1MessageList for returning warning and informational
messages.
a. When the superclass is modified it will be underlined in red. The red means JDeveloper
doesnt know what it is.
b. Place your cursor over the superclass name. When the little blue popup shows up, hit AltEnter to import the file where MessageValueObject is defined
(oracle.e1.bssvfounation.base.MessageValueObject). Imports work the same as include
statements in C.
c. You will notice the new line in the import section at the top for the code screen.
9.
At the bottom of the RetrunABInfo class, add a new constructor as shown below. This class
already has a default constructor, but we will need this new special constructor later.
a. After creating the new constructor place your cursor over the InternalGetABInfo. After the
little blue popup shows up, hit Alt-Enter to import the file where InternalGetABInfo is
defined. This will be the new internal value object class we created earlier .
Page 18
Find the J550001 project in the tree view in the work space pane on the right. Right click on the
J550001 project and select New from the pop up menu.
2. In the tree view on the left click on Classes under EnterpriseOne. Select Business Service Class in
the list on the right. Click on OK.
Page 19
3.
Define the new business class. This class will not be published; it will only be accessible to other
functions on the BSSV server.
a. Enter ABInfoTest for the class name.
b. Enter getABInfoInternal for the new method name.
c. Browse for the input class. This will be the new internal value object class we created
earlier. Find the InternalGetABInfo value object class.
d. Click OK.
Page 20
The new internal business service class will be generated with the get method. At this point the
class is just a skeleton and does nothing.
Find the JP550001 project in the tree view in the work space pane on the right. Right click on the
JP550001 project and select New from the pop up menu.
6.
In the tree view on the left click on Classes under EnterpriseOne. Select Published Business
Service Class in the list on the right. Click on OK.
Page 21
7.
Define the new published business class. This class will be published. A published business
service class requires an input value object class and an output value object class.
a. Enter ABInfoTestPub for the class name.
b. Enter getABInfo for the new method name.
c. Browse for the input class. This will be the new value object class we created earlier. Find
the GetABInfo value object class.
d. Browse for the output class. This will be the new value object class we created earlier.
Find the ReturnABInfo value object class.
e. Click OK.
Page 22
8.
The new published business service class will be generated with the get method. At this point the
class is just a skeleton and does nothing.
2.
Find the TODOs in the skeleton code and add new code so it matches below.
Page 23
3.
4.
You may need to use Alt-Enter to add some imports for the new code. Do this for each object in
your code that is underlined in red.
Make the business service projects. Highlight each project and click on the Make button to compile.
Resolve any compile errors.
Page 24
Find the J550001 project in the tree view in the work space pane on the right. Right click on the
J550001 project and select New from the pop up menu.
2.
In the tree view click on General. Select Java Class in the list on the right. Click on OK.
Page 25
3.
4.
Add the following code to the new Java Class. Include testGetABInfo anywhere inside the class.
Page 26
5.
6.
7.
8.
Use Alt-Enter to add the import statements as needed. BusinessServiceException should use
oracle.e1.bssvfoundation.exception.
Click on Save
Make/Compile the new Java Class.
Click on Run to run the process.
Page 27
9.
We havent written any code to call the E1 business function or to pass values back and forth yet
so after all of this work so far it still pretty much still does nothing.
Page 28
Locate the new public constructor that we added to the return object class earlier (ReturnABInfo).
Add the code as shown below. Using the accessors, it will copy the values across.
You will notice some code that has underlines indicating compile issues. These exist because of
type conversion issues. We need to create overloaded accessors to handle the type conversions.
Add the following accessors.
Page 29
4.
Do a Save All
Page 30
3.
4.
Page 31
5.
Set the input and outputs as shown. The selection of the check boxes on each item creates the
appropriate code to send data to the BSFN and return data back.
6.
The wizard creates a new method based on your input above. It creates a call to the new method
on the line where you invoked the wizard to call an E1 BSFN. Verify the code looks the same as
below adding code as necessary under the TODO reminder comments. Notice that we added code
to the BSFN call line so we can return messages from the call.
Page 32
7.
You will notice some red underlines indicating a compile issue. When the wizard that created the
new method calls the business function it specifies a generic InputVOType, see below. You need
to fix this to use the actual value object class that is being used. In this case we need to replace
InputVOType with InternalGetABInfo.
8.
9.
Page 33
3.
You can test with other address book numbers by changing this line of code in the test class.
inputVo.setAddressNumber(new Integer (100110));
Page 34
3.
4.
5.
6.
Scott Beebe has eighteen years of experience in software development, implementation, and
customization, including 14 years of JD Edwards OneWorld/EnterpriseOne Development. Experience
includes software design and development, database design, and customizing and
troubleshooting of J.D. Edwards EnterpriseOne software. Additional J.D. Edwards experience
includes post implementation support, system design and analysis, enhancements, conversions,
modifications, retrofits, implementation, user support and training, technical troubleshooting,
delivered portal components, developed JAVA components to plug into the portal, and systems
management. Scott's website can be viewed here: http://jdetoolsplus.com/
Visit www.JDEtips.com for information on JDEtips University schedule, on-site training and consulting, and
our Journal Document Library.
License Information: The use of JDE is granted to Klee Associates, Inc. by permission from J.D. Edwards World Source Company. The
information on this website and in our publications is the copyrighted work of Klee Associates, Inc. and is owned by Klee Associates, Inc.
Page 35
Page 36