Friday, May 30, 2003

Service-enable EJB SessionBeans with Apache Axis and the IBM ETTK

Apache Axis and EJB


This article shows J2EE developers how to use Apache Axis from the IBM ETTK (Emerging Technologies Toolkit) to make any Enterprise JavaBean (EJB) component into a Web service that will run on any application server.

Tutorial link





This tutorial shows J2EE developers how to use the IBM ETTK (Emerging Technologies Toolkit) to make any Enterprise JavaBean (EJB) component into a Web service that will run on any application server.

Do you currently use EJB technology? Have you ever wondered how to expose an EJB component as a Web service no matter what your application server is? This tutorial shows how to use the ETTK and Axis to convert a local and remote EJB component into a Web service. I will use a subcomponent of the ETTK called Axis, a SOAP client implementation originally hosted by the Apache Software Foundation.

The ETTK implements the Web services architecture and provides a set of tools to create, locate and invoke Web services. It includes the following tools:



  • UDDI4J API allows developers to perform save, delete, find, and get operations against a UDDI registry.
    UDDI4J-WSDL API allows developers to perform publish, unpublish, and find operations against a UDDI registry.
    WSDL4J allows developers to programmatically read and work with WSDL documents.



  • WSDLdoc allows developers to automatically generate documentation from WSDL files similar to JavaDoc.
    WSIL4J allows developers to programmatically read and work with WSIL documents.



  • Axis RC1 allows a developer to generate Web services WSDL definitions from Java code and generate Java proxy code from a WSDL definition. Axis is also the transport engine for Web services.



  • Sample services including Accounting, Contract, Metering, Service Desk etc.



  • Demos and tutorials to illustrate key Web service concepts.



  • Privacy Policy Authorization Director (PAD) Web service allows privacy policy control access to personal information.



  • And much more...



If you are serious about Web services then you have to check out IBM's ETTK!


The primary focus of this tutorial is developing EJB-based Web services with Axis. Axis provides support for turning EJB components into Web services and is included with the ETTK.


What this tutorial covers page

This tutorial covers turning EJB components into Web services and has two step-by-step examples. The first example uses all primitive types with one simple EJB component. The second example uses a SessionBean that talks to several EJB components and returns complex types. All examples ship with a set of Ant build scripts so you can easily create your own custom solutions by reusing the sample build files.

This tutorial assumes you have a working knowledge of Java technology and EJB technology. In-depth knowledge of EJB components, Web services, and Ant are helpful but not required to understand the key concepts. Ant is used to build and deploy the example applications. Reference to introductory material on Ant, Java technology, J2EE, Web services, XML, and EJB components are provided in throughout the tutorial and at the references section at the end of this tutorial.

The source code in the tutorial has been tested with Resin EE application server.

The applications should be easy to port to other J2EE-compliant application servers like IBM WebSphere or JBoss. Please check back at my site for ports to other application servers (see Resources).

I typically get examples from people working with other application servers, and then I put them up on my site (see Resources).

I used the Eclipse framework to create the examples in this tutorial. The examples are easiest to run by downloading Eclipse 2.1 or higher and a J2EE application server plug-in for Eclipse. Eclipse has excellent support for Ant, which facilitates running the Axis and XDoclet Ant tasks right from the IDE environment.

If you are new to Ant, please read this sample chapter from Mastering Tomcat on Developing Web Components with Ant (written by yours truly). Just read the sections on Ant development for now.
Using Ant

Also note that the Ant scripts can use XDoclet. You will not need to use this functionality, but, in case you decide to, please refer to the developerWorks tutorial, "Enhance J2EE component reuse with XDoclet" (see Resources).

Wednesday, May 21, 2003

Speed J2EE component development with XDoclet

Speed J2EE component development with XDoclet


I wrote a tutorial on XDoclet for IBM developerWorks.

"This tutorial shows how to speed J2EE development with XDoclet. Why write five classes and three deployment descriptor when you can write one and generate the rest? This tutorial consists of step by step examples using XDoclet with Servlets, Custom Tags and EJB (with CMP, CMR 2.0). XDoclet is an open source project that aids in the development of J2EE components."

DeveloperWorks article
Java Channel link to tutorial
JavaRanch link to tutorial
JavaLobby link to tutorial

Sunday, May 04, 2003

JDJ this month: Good Articles this month

Picked up a copy of the JDJ this month. What a great issue! I am really enjoying reading about in container caching, although I don't 100% agree with the conclusion. I believe the results she got, but I don't agree that that is the type of thing you usually cache. I thought the article could have spent more time talking about when/why to use caching instead of making up a contrived example that would obviously break. And, although I did not agree with the conclusion, I really found the article interesting. I've run into problems with caching before. I have had similar experience that the article was talking about. A little caching good.... too much is evil. Be careful what you cache. It can be great. Too much and it can kill.

I browsed the rest of the magazine. There seems to be some good articles on Abbot and Big Brother (CI tool). I look forward to reading these as I fly from AZ to Minnesota on Tuesday. Has anyone tried using caching against a RAM Disk? I was going to try this on a project, but decided to cache some results on HD and small frequently used data in a weak hash map instead. The important thing is that I knew how much the data would grow (the upper limit). I'd like to try the RAM disk approach (with a LRU type cache) so the garbage collector would not have to manage the memory. Hmmmmmmmmmmm.....

Hmmmmm..... I noticed my resume comes up second when searching for Rick Resume I love google

Click here and look at the second link

Rick Resume

Saturday, May 03, 2003

Get Tomcat book examples working for Xdoclet 1.2

Get Tomcat book examples working for Xdoclet 1.2
Upgrade examples to the lastest version of Xdoclet (xdoclet 1.2)
Finish writing/updating tutorial
Add EJB support....from previous work.
sounds like a lot of work.

Find the files move them over... then port. Start with the Servlet example and Custom Tag example. Upgrade to latest ant first.

I changed the script to use a path instead of putting a list of jars in the build.properties.

Upgrading example to 1.2 from Xdoclet 1.1 problems:

1) the webdoclet task no longer supports sourcepath. I removed it from the example ant script.

2) xdoclet.web.WebDocletTask is deprecated. I changed the taskdef to use xdoclet.modules.web.WebDocletTask

After that everything worked groovey.I came up with an idea. An Ant task that takes an eclipse .classpath file (which is just an xml file anyway) and adds every item to the classpath. This would make things a little easier.when working with eclipse. Hmmmm....

Tutorial for IBM, toot-o-matic

I am working on a tutorial for IBM. My laptop crashed since the last time I wrote a tutorial. I have a new laptop. I need to reinstall all of the software to write the tutorial. You write the IBM tutorials in XML then use a tool called Toot-o-matic from IBM to convert it to HTML and PDF format. The tool is open source and uses XSLT.

I wrote a preprocessor that coverts a text file into the XML file in jython so that I can use the spell checker and grammar checker of MS Word before I make a fool of myself.

I have to download jython, toot-o-matic, and who know what else to get this

started.... here we go....

Doug Tidwell is too funny.... I am looking for a download link for

toot-o-matic and I ran into his bio....


About the author
MC Dug-T is developerWorks' Minister of Science, droppin' the XML, Java,

and Web services 411 on the public. In his travels, he gets mad props from

his peeps worldwide for the stone-cold, stoopid-fresh style sheets he leaves

behind. All his mad-phat nollidge will soon be published by O'Reilly and

Associates in the Strictly Non-Fiction book XSLT (ISBN 0596000537, pre-order

your copy today at amazon.com) which will then start slayin' soft-sellin'

suckas at tha local booksella. Discussing the book in a recent dW interview,

he boasted, "I'm gonna empty mah dome into one supa-fly tome."
For relaxation, he likes to put his hands up in the air, and in his words,

"wave 'em around like I just don't care." When not chillin' with his

worldwide XML krew, he maxes at the crib in Raleigh with his wife, cooking

teacher CT-ONE, and their six-year-old shortie, Lily the Flayva Princess.

You can send him a shout-out at dtidwell@us.ibm.com.


How funny is that? :)

The tutorial link for toot-o-matic
http://www-106.ibm.com/developerworks/library/x-toot/index.html

Here is the download link from the tutorial
https://www6.software.ibm.com/dl/devworks/dw-tootomatic-p

There are two download files.... jars.zip and tootomatic.zip...
Hmmm... jars.zip is ten times bigger than tootomatic.zip
better get them both.

now what... no instructions....

Ahhh... the directions are in the tootomatic.zip file....

here they are....
****************************
Installing the Toot-O-Matic:

To install the Toot-O-Matic, unzip the files tootomatic.zip and jars.zip

into the same directory on your hard drive.

Toot-O-Matic uses the Java 2 SDK, 1.3.0_02. You can download it from
http://java.sun.com/products/archive/index.html.
****************************

now i need to install jython...
http://sourceforge.net/project/showfiles.php?group_id=12867&release_id=67726


it looks like tootomatic changed since the last time I used it...
now they are using XML Schema instead of dtds... hmmm....
my xml tut files don't work anymore... hmmm...
looks like i can use either dtd or xsd... i'll stick with dtds for now.

my preprocessor sticks the wrong dtd location in the file....
quick change. no problem... i am up an running.

Looking for an eclipse plugin that support XDoclet and finding all kinds of other stuff too

I want to checkout Easy Struts, the JBoss IDE, and Lomboz , and this http://sourceforge.net/projects/javacodemaker.

The last one does not appear to be fully baked... yet.

Anyone tried any of these.....

Hmmmm..... unrelated....
Jdepend does metrics… do we want this…. ???

Here is an article I plan on reading regarding EJB testing.... Automating EJB Unit Testing.
See if he has similar thoughts than I do on this subject.... maybe catch an aha or two in the progress.

and just for kicks.... i want to check out http://sourceforge.net/projects/xpetstore/. This is a project I would like to get involved in.... after I am done with EasyEJB 1.0 release.

Another tool i am dying to try out is MiddleGen.... http://sourceforge.net/projects/middlegen/

Hmmm... i want more eclipse tools.... i need a UML plugin, a database plugin and a good xdoclet plugin.....

JDJ Mag..... CD packed full of articles

I got my new JDJ Mag with the CD of every article ever written by the JDJ.
I was searching for article I wrote when I ran accross this.....

It was a show report by Stephen Berkowitz:

"I would be remiss if, in the focus on Web services, I failed to point out that the conference also had a Java focus. The best Java presentation I went to was given by Rick Hightower of Trivera. His talk on "Java Tools for Extreme Programming" was well presented and rather informative. Rick focused on the testing and continuous integration portions of XP, discussing JUnit, Ant, and Cactus in detail. His talk proved to me that no matter what you are doing, no matter what you call your methodology, testing is invaluable and that these tools will make your life easier. "

Excellent. I am glad you liked it.
This was my first presentation in a long time, and I was pretty nervous.

Friday, May 02, 2003

Custom Tag

Last night (yesterday) I wrote a custom tag for the Struts course, and wrote a Cactus test for it.
The custom tag prints out a value of a property from an EJB. It is called EJBWrite.
It is like BeanWrite (a struts custom tag), but different.

It uses BeanUtils, ResponseUtils, RequestUtils, and Property Utils. (three birds.... one stone)

I also dug into WSAD for several hours. I am becoming an expert. If you love Eclipse, you will go ga ga over WSAD

Speaking at JavaOne... Info....

Speaking at JavaOne! Yeah!

Using Enterprise JavaBeans(TM) (EJBTM) Technology on More Projects with CMP, CMR and XDoclet TS-3198
Speakers: Rick Hightower
Thursday Jun 12, 1:30 PM - 2:30 PM, Esplanade 301, Moscone Center

There has recently been a lot of discussion about whether or not to use Enterprise JavaBeans(TM) (EJBTM) technology. This session shows that EJB technology can be used on many more projects than it is currently. The argument against using EJB technology tends to be that it is too complex. This is ironic since EJB technology's purpose was to simplify server-side development. While it is true EJB.....

This is the first time speaking at JavaOne. I was part of a BOF once. I was on a BOF panel. And, I've had booth duty for three different companies at JavaOne, but never a session. I am stoked!

Thursday, May 01, 2003

I really dig StrutsTestCase

I really dig StrutsTestCase


It took me a while to get things installed and configured, but it was worth it. (StrutsTestCase in not compatible with the version of Cactus that the Eclipse Cactus plugin in uses..... this was one of the many issues I ran into.)

StrutsTestCase allows you to easily test StrutsActions:

Check out the following code listing:


public class EditEmployeeActionTest extends CactusStrutsTestCase {



/**
* Constructor for EditEmployeeActionTest.
* @param arg0
*/
public EditEmployeeActionTest(String arg0) {
super(arg0);
}

/*
* @see TestCase#setUp()
*/
public void setUp() throws Exception {
super.setUp();
}

/*
* @see TestCase#tearDown()
*/
protected void tearDown() throws Exception {
super.tearDown();
}

public void testEditEmployeeAction () throws Exception{

/* Create the test employee */
String firstName = "Bob";
String lastName = "Jones";
String phone = "555 1212";
Integer id = Util.createTestEmployee(firstName, lastName, phone);

/* set the path to the EditEmployeeAction's path */
setRequestPathInfo("/editEmployee");

/* set the employee id to load */
addRequestParameter("id", "" + id);

/* Force the action to occur */
actionPerform();

/* Make sure the action forwarded to the form */
verifyForward("form");

/* Get the EmployeeForm from the request attribute */
EmployeeForm form = (EmployeeForm) request.getAttribute("employeeForm");

/* See if it is in edit mode */
assertEquals(EmployeeForm.EDIT_MODE, form.getAction());

/* Make sure this is the right employee */
assertEquals(firstName, form.getEmployee().getFirstName());
assertEquals(lastName, form.getEmployee().getLastName());
assertEquals(phone, form.getEmployee().getPhone());

Util.killTestEmployee(id);

/* Make sure there are no errors */
verifyNoActionErrors();

}

}