JXMLSec (Tools Release 8.9x)

Introduction:

CNC Administrators often need to perform bulk password resets for Oracle EnterpriseOne user IDs. The JXMLSec is a Java GUI tool developed by Luis A. Santillo that can assist you in this task. This document contains instructions on how to build and run the tool.

Notes:

The JXMLSec (Tools Release 8.9x) was developed and tested using EnterpriseOne 8.12, Tools Release 8.96.C1, and Java Development Kit (JDK) 1.4.2_10 on machine running Windows 2000 Professional SP4. Enterprise Server on Windows 2003 Server Standard running MS SQL Server 2000 SP3.

This tool is FREEWARE. You can use it freely, but at your own risk! In no event will the author be liable for any damages arising from use of this software. If you find this tool useful (or if you run into any issues while trying the steps below), please feel free to contact the author at . If you modify this tool to add functionality, the author would appreciate a copy of the new code.

Installation and Configuration:

1) Verify that a supported Java Development Kit (JDK) is installed in the workstation to be used in the task (for example, verify that JDK 1.4.2_10 is installed).

2) Create a new directory in the workstation (for example, C:\JXMLSec).

3) Copy the following files from the Deployment server to the directory created in step 2:

a. E812\System\classes\Base_JAR.jar

b. E812\System\classes\jdelog.properties

c. E812\System\classes\JdeNet_JAR.jar

d. E812\System\classes\log4j.jar

e. E812\System\classes\System_JAR.jar

Note: If you have multiple-foundation implemented in the system, make sure the files you are copying match the Tool Release installed in the enterprise server.

4) Create a new text file using the text editor of your choice (for example, Notepad).

5) Paste the following text to the new document:

@echo off

REM JDK root directory

set JAVA_HOME=C:\j2sdk1.4.2_10

REM this directory

set EXAMPLES=C:\JXMLSec

REM set the CLASSPATH environment variable

set CLASSPATH=%EXAMPLES%\Base_JAR.jar

set CLASSPATH=%CLASSPATH%;%EXAMPLES%\JdeNet_JAR.jar

set CLASSPATH=%CLASSPATH%;%EXAMPLES%\log4j.jar

set CLASSPATH=%CLASSPATH%;%EXAMPLES%\System_JAR.jar

6) Save the file as setenv.bat in the directory created in step 2 (for example, C:\JXMLSec\setenv.bat).

7) If needed, modify the setenv.bat file created in the last step to reflect the characteristics of the machine:

a) Ensure that "set JAVA_HOME" command sets the variable with correct path to JDK directory (for example, "set JAVA_HOME= C:\j2sdk1.4.2_10").

b) Ensure that "set EXAMPLES" command sets the variable with the correct path to directory created in step 2 (for example, "set EXAMPLES=C:\JXMLSec").

f) Set and append the path to Jar files you copied in step 3 to the CLASSPATH variable (for example,

“set CLASSPATH=%EXAMPLES%\Base_JAR.jar”,

“set CLASSPATH=%CLASSPATH%;%EXAMPLES%\ JdeNet_JAR.jar”, etc.).

8) Create a new text file using the text editor of your choice (for example, Notepad).

9) Paste the following text to the new document:

import java.awt.*;

import java.awt.event.*;

import java.io.*;

import java.util.GregorianCalendar;

import java.util.Date;

import javax.swing.JOptionPane;

import javax.swing.JFrame;

import com.jdedwards.system.xml.XMLRequest;

import com.jdedwards.system.net.JdeNetTimeoutException;

import com.jdedwards.system.net.JdeNetConnectFailedException;

//************************************************************

// Application: JXMLSec

// Description: Java tool that updates OneWorld® security

// Author: Luis A. Santillo

//************************************************************

public class JXMLSec extends JFrame implements ActionListener {

Panel xmlPanel;

Label userNameLabel;

Label userPwdLabel;

Label environmentLabel;

Label serverNameLabel;

Label portNumberLabel;

Label newPwdLabel;

Label loadListLabel;

Label dummyLabel;

TextField userNameField;

TextField userPwdField;

TextField environmentField;

TextField serverNameField;

TextField portNumberField;

TextField newPwdField;

List requestList;

TextArea replyArea;

Button submitButton;

Button loadListButton;

Checkbox forceCheckbox;

String directory;

String owServerName;

int owPortNumber;

String listUser;

String requestString;

String replyString;

MenuBar mb = new MenuBar();

Menu fileMenu = new Menu("File");

Menu helpMenu = new Menu("Help");

MenuItem openMenuItem = new MenuItem("Load List");

MenuItem exitMenuItem = new MenuItem("Exit");

MenuItem helpMenuItem = new MenuItem("About");

public static void main(String args[]) {

JXMLSec jxmltool = new JXMLSec();

jxmltool.init();

}

public void init () {

xmlPanel = createXMLPanel();

this.setSize(540, 480);

this.setResizable(true);

this.getContentPane().add(xmlPanel, BorderLayout.CENTER);

this.setVisible(true);

this.setTitle("JXMLSec (Tools Release 8.9x)");

openMenuItem.addActionListener(this);

fileMenu.add(openMenuItem);

fileMenu.add(new MenuItem("-"));

exitMenuItem.addActionListener(this);

fileMenu.add(exitMenuItem);

helpMenuItem.addActionListener(this);

helpMenu.add(helpMenuItem);

mb.add(fileMenu);

mb.add(helpMenu);

this.setMenuBar(mb);

submitButton.addActionListener(this);

loadListButton.addActionListener(this);

directory = System.getProperty("user.dir");

this.pack();

}

private Panel createXMLPanel()

{

GridBagLayout gridbag = new GridBagLayout();

GridBagConstraints constraints = new GridBagConstraints();

xmlPanel = new Panel();

xmlPanel.setLayout(gridbag);

constraints.insets = new Insets(0, 5, 0, 5);

buildConstraints(constraints, 0, 0, 1, 1, 5, 2);

constraints.fill = GridBagConstraints.BOTH;

userNameLabel = new Label("JDE User", Label.CENTER);

gridbag.setConstraints(userNameLabel, constraints);

xmlPanel.add(userNameLabel);

buildConstraints(constraints, 1, 0, 1, 1, 5, 0);

constraints.fill = GridBagConstraints.BOTH;

userPwdLabel = new Label("JDE Password", Label.CENTER);

gridbag.setConstraints(userPwdLabel, constraints);

xmlPanel.add(userPwdLabel);

buildConstraints(constraints, 2, 0, 1, 1, 5, 0);

constraints.fill = GridBagConstraints.BOTH;

environmentLabel = new Label("JDE Environment", Label.CENTER);

gridbag.setConstraints(environmentLabel, constraints);

xmlPanel.add(environmentLabel);

buildConstraints(constraints, 0, 1, 1, 1, 5, 2);

constraints.fill = GridBagConstraints.NONE;

userNameField = new TextField("", 15);

gridbag.setConstraints(userNameField, constraints);

xmlPanel.add(userNameField);

buildConstraints(constraints, 1, 1, 1, 1, 5, 2);

constraints.fill = GridBagConstraints.NONE;

userPwdField = new TextField("", 15);

userPwdField.setEchoChar('*');

gridbag.setConstraints(userPwdField, constraints);

xmlPanel.add(userPwdField);

buildConstraints(constraints, 2, 1, 1, 1, 5, 2);

constraints.fill = GridBagConstraints.NONE;

environmentField = new TextField("", 15);

gridbag.setConstraints(environmentField, constraints);

xmlPanel.add(environmentField);

buildConstraints(constraints, 0, 2, 1, 1, 5, 2);

constraints.fill = GridBagConstraints.BOTH;

serverNameLabel = new Label("JDE Server", Label.CENTER);

gridbag.setConstraints(serverNameLabel, constraints);

xmlPanel.add(serverNameLabel);

buildConstraints(constraints, 1, 2, 1, 1, 5, 0);

constraints.fill = GridBagConstraints.BOTH;

portNumberLabel = new Label("JDENET Port", Label.CENTER);

gridbag.setConstraints(portNumberLabel, constraints);

xmlPanel.add(portNumberLabel);

buildConstraints(constraints, 0, 3, 1, 1, 5, 2);

constraints.fill = GridBagConstraints.NONE;

serverNameField = new TextField("", 15);

gridbag.setConstraints(serverNameField, constraints);

xmlPanel.add(serverNameField);

buildConstraints(constraints, 1, 3, 1, 1, 5, 0);

constraints.fill = GridBagConstraints.NONE;

portNumberField = new TextField("", 15);

gridbag.setConstraints(portNumberField, constraints);

xmlPanel.add(portNumberField);

constraints.insets = new Insets(0, 15, 0, 15);

buildConstraints(constraints, 2, 3, 1, 1, 5, 0);

constraints.fill = GridBagConstraints.BOTH;

loadListButton = new Button("Load List");

gridbag.setConstraints(loadListButton, constraints);

xmlPanel.add(loadListButton);

constraints.insets = new Insets(5, 5, 5, 5);

buildConstraints(constraints, 0, 4, 3, 1, 10, 40);

constraints.fill = GridBagConstraints.BOTH;

requestList = new List(4, false);

gridbag.setConstraints(requestList, constraints);

xmlPanel.add(requestList);

constraints.insets = new Insets(0, 5, 0, 5);

buildConstraints(constraints, 0, 5, 1, 1, 5, 5);

constraints.fill = GridBagConstraints.BOTH;

newPwdLabel = new Label("New Password", Label.CENTER);

gridbag.setConstraints(newPwdLabel, constraints);

xmlPanel.add(newPwdLabel);

constraints.insets = new Insets(0, 5, 0, 5);

buildConstraints(constraints, 0, 6, 1, 1, 10, 0);

constraints.fill = GridBagConstraints.NONE;

newPwdField = new TextField("", 15);

gridbag.setConstraints(newPwdField, constraints);

xmlPanel.add(newPwdField);

buildConstraints(constraints, 1, 6, 1, 1, 10, 0);

constraints.fill = GridBagConstraints.NONE;

forceCheckbox = new Checkbox("Force Password Change");

gridbag.setConstraints(forceCheckbox, constraints);

xmlPanel.add(forceCheckbox);

constraints.insets = new Insets(0, 15, 0, 15);

buildConstraints(constraints, 2, 6, 1, 1, 10, 0);

constraints.fill = GridBagConstraints.BOTH;

submitButton = new Button("Submit");

gridbag.setConstraints(submitButton, constraints);

xmlPanel.add(submitButton);

constraints.insets = new Insets(5, 5, 10, 5);

buildConstraints(constraints, 0, 7, 3, 1, 10, 40);

constraints.fill = GridBagConstraints.BOTH;

replyArea = new TextArea("", 10, 80);

replyArea.setBackground(Color.gray);

gridbag.setConstraints(replyArea, constraints);

xmlPanel.add(replyArea);

return xmlPanel;

}

void buildConstraints(GridBagConstraints gbc, int gx, int gy, int gw, int gh, int wx, int wy) {

gbc.gridx = gx;

gbc.gridy = gy;

gbc.gridwidth = gw;

gbc.gridheight = gh;

gbc.weightx = wx;

gbc.weighty = wy;

}

public void actionPerformed(ActionEvent e) {

if (e.getSource() instanceof MenuItem) {

String label = ((MenuItem)e.getSource()).getLabel();

if (label.equals("File"));

if (label.equals("Load List")) {

FileDialog f = new FileDialog(this, "Load List", FileDialog.LOAD);

f.setDirectory(directory);

f.show();

directory = f.getDirectory();

requestList.removeAll();

loadFile(directory, f.getFile());

f.dispose();

}

if (label.equals("Exit"))

System.exit(0);

if (label.equals("About")) {

String messageText;

messageText = "JXMLSec (Tools Release 8.9x)\n";

messageText = messageText + "Java tool to reset passwords in EnterpriseOne®\n";

messageText = messageText + "Copyright © 2006 Luis A. Santillo";

JOptionPane.showMessageDialog(null, messageText, "About", JOptionPane.INFORMATION_MESSAGE);

};

}

if (e.getSource() instanceof Button) {

String label = ((Button)e.getSource()).getLabel();

if (label.equals("Load List")) {

FileDialog f = new FileDialog(this, "Load List", FileDialog.LOAD);

f.setDirectory(directory);

f.show();

directory = f.getDirectory();

requestList.removeAll();

replyArea.setText("");

loadFile(directory, f.getFile());

f.dispose();

}

if (label.equals("Submit")) {

if (serverNameField.getText().equals("")) {

writeMessage(" **** Error: Invalid server name!\n");

} else if (portNumberField.getText().equals("")) {

writeMessage(" **** Error: Invalid port number!\n");

} else if (userNameField.getText().equals("")) {

writeMessage(" **** Error: Invalid user name!\n");

} else if (userPwdField.getText().equals("")) {

writeMessage(" **** Error: Invalid user password!\n");

} else if (environmentField.getText().equals("")) {

writeMessage(" **** Error: Invalid environment!\n");

} else if (newPwdField.getText().equals("")) {

writeMessage(" **** Error: Invalid new password!\n");

} else {

try {

owServerName = serverNameField.getText();

owPortNumber = Integer.parseInt(portNumberField.getText());

if (requestList.getItemCount() == 0) {

writeMessage(" **** Error: empty list!\n");

} else {

writeMessage(" **** All fields validated. Starting new run.\n");

for (int i = 0; i < requestList.getItemCount(); i++) {

writeMessage(" **** Submiting " + (i + 1) + " of " + requestList.getItemCount() + ".\n");

requestString = "<?xml version='1.0' ?> ";

requestString = requestString + "<jdeRequest type='callmethod' user='" + userNameField.getText() + "' ";

requestString = requestString + "pwd='" + userPwdField.getText() + "' ";

requestString = requestString + "environment='" + environmentField.getText() + "' session=''> ";

requestString = requestString + "<callMethod name='F98OWSECUpdateRecords' app='JXMLSec'> ";

requestString = requestString + "<params> ";

requestString = requestString + "<param name='szGroup'>" + requestList.getItem(i) + "</param> ";

requestString = requestString + "<param name='szOWPassword'>" + newPwdField.getText() + "</param> ";

requestString = requestString + "<param name='szSystemUser'> </param> ";

requestString = requestString + "<param name='szSystemPassword'> </param> ";

requestString = requestString + "<param name='jdLastChangeDate'> </param> ";

requestString = requestString + "<param name='mnFrequency'>90</param> ";

requestString = requestString + "<param name='cAllUsers'> </param> ";

requestString = requestString + "<param name='szDataSource'> </param> ";

requestString = requestString + "<param name='mnAllowedAttempts'>3</param> ";

requestString = requestString + "<param name='mnRetryCount'>0</param> ";

requestString = requestString + "<param name='szEnabledUser'>01</param> ";

requestString = requestString + "<param name='szToUser'> </param> ";

requestString = requestString + "<param name='cReturnCode'> </param> ";

requestString = requestString + "<param name='cOverrideFlag'> </param> ";

requestString = requestString + "<param name='szUser'> </param> ";

if (forceCheckbox.getState() == true) {

requestString = requestString + "<param name='szForceImmediatePasswordCh'>1</param> ";

} else {

requestString = requestString + "<param name='szForceImmediatePasswordCh'>0</param> ";

}

requestString = requestString + "</params> ";

requestString = requestString + "</callMethod>";

requestString = requestString + "</jdeRequest>";

replyString = submitXMLRequest(requestString);

//writeMessage(replyString);

if (replyString.indexOf("<returnCode code='0'") > 0) {

writeMessage(" **** Success updating pwd for user " + requestList.getItem(i) + ".\n");

} else {

writeMessage(" **** BSFN did not return success.\n");

writeMessage(" **** " + replyString + "\n\n");

break;

}

}

writeMessage(" **** Done.\n");

}

} catch (NumberFormatException nfex) {

writeMessage(" **** Error: unable to format port number!\n");

writeMessage(" **** Exception: " + nfex +"\n");

}

}

}

}

}

public void loadFile(String directory, String filename) {

if ((filename == null) || (filename.length() == 0)) return;

File f;

BufferedReader br = null;

String sLine;

try {

f = new File(directory, filename);

br = new BufferedReader(new FileReader(f));

while ((sLine = br.readLine()) != null) {

requestList.add(sLine);

}

br.close();

writeMessage(" **** List loaded.\n");

}

catch (IOException e) {

writeMessage(" **** " + e.getMessage() +"\n");

}

finally { try { if (br != null) br.close(); } catch (IOException e) {} }

}

public void writeMessage(String sText) {

GregorianCalendar gregCalendar = new GregorianCalendar();

replyArea.setText(replyArea.getText() + gregCalendar.getTime() + sText);

}

public String submitXMLRequest(String xmlIn) {

String xmlOut = null;

try {

XMLRequest xml = new XMLRequest(owServerName, owPortNumber, xmlIn);

xmlOut = xml.execute();

}

catch (JdeNetTimeoutException toex) {

writeMessage(" **** Error: JDENet timed out!\n");

writeMessage(" **** Exception: " + toex +"\n");

return "<returnCode code='2'";

}

catch (JdeNetConnectFailedException cfex) {

writeMessage(" **** Error: JDENet connect failed!\n");

writeMessage(" **** Exception: " + cfex +"\n");

return "<returnCode code='2'";

}

catch (java.io.IOException ioex) {

writeMessage(" **** Error: IO Exception!\n");

writeMessage(" **** Exception: " + ioex +"\n");

return "<returnCode code='2'";

}

return xmlOut;

}

public void processWindowEvent(WindowEvent e) {

if (e.getID() == Event.WINDOW_DESTROY) {

System.exit(0);

}

}

}

10) Save the file as JXMLSec.java in the directory created in step 2 (for example, C:\JXMLSec\JXMLSec.java).

Note: Make sure that Notepad saved file as JXMLSec.java and not JXMLSec.java.txt. Rename it removing extension txt if necessary.

11) Create a new text file using the text editor of your choice (for example, Notepad).

12) Paste the following text to the new document:

@echo off

call setenv.bat

set CLASSPATH=%CLASSPATH%;.

%JAVA_HOME%\bin\javac JXMLSec.java

13) Save the file as build.bat in the directory created in step 2 (for example, C:\JXMLSec\build.bat).

14) Build the JXMLTool Java application:

a) Open a new MS-DOS Command Prompt window.

b) Change the current directory to the directory created in step 2.

c) Call the build.bat script to compile the Java code and create the JXMLSec Java class.

d) Verify that JXMLSec.class exists in the directory created in step 2 (for example, “C:\JXMLSec\JXMLSec.class”).

15) Create a new text file using the text editor of your choice (for example, Notepad).

16) Paste the following text to the new document:

@echo off

call setenv.bat

set CLASSPATH=%CLASSPATH%;.

java JXMLSec

17) Save the file as run.bat in the directory created in step 2 (for example, C:\JXMLSec\run.bat).

Usage:

The JXMLSec tool uses text files containing a list of user IDs in uppercase separated by carriage returns as input. In other words, a text file containing one user ID per line.

1) Open a new MS-DOS Command Prompt window.

2) Change the current directory to the directory created in step 2.

3) Call the run.bat script to execute the JXMLSec Java application.

5) In the Java application, enter valid EnterpriseOne user, password, environment, enterprise server name, and port number in appropriate text fields.

6) Use the “Load List” button to find and select input text file.

7) Enter the desired new password in appropriate text field. Select check box to force users to change password the next time they log into the system.

8) Click the button “Submit”.

9) The lower panel will show the progress of the run. In case an error is returned by the enterprise server, the reply XML document will also be displayed in this panel.

Page 1 of 10