[jdom-interest] JDOM w/ Apache Axis

Jerry Jalenak Jerry.Jalenak at LABONE.com
Tue Apr 13 09:25:14 PDT 2004


Greetings All!

I'm fairly new to using JDOM to generate XML, so bear with me.  I'm in the
processing of writing a web service using Apache Axis.  As part of my
'learning' process, I've been able to have a dotNet client hit my web
service and retrieve a basic String, a basic JavaBean, and an Array object
from the JavaBean.  I'm now trying to generate a XML document using JDOM,
and pass it back to the client.  Here's my basic 'HelloWorld'
implementation:

package ws;

import org.jdom.Element;

/**
 * @author jjalenak
 *
 */
public class HelloWorldImpl implements HelloWorld
{
	/* (non-Javadoc)
	 * @see ws.HelloWorld#hello()
	 */
	public Document hello() throws Exception
	{
		Document _d = new Document();
		
			Element _e = new Element("root");
			_e.setText("Hi There!");

		_d.setRootElement(_e);
		return _d;
	}

	/* (non-Javadoc)
	 * @see ws.HelloWorld#goodbye()
	 */
	public Document goodbye() throws Exception
	{
		Document _d = new Document();
		
			Element _e = new Element("root");
			_e.setText("Good Bye!");

		_d.setRootElement(_e);
		return _d;
	}
}

When I ran the WSDL2JAVA emitter, it created a 'Document' bean in my 'ws'
package, and removed the import for the org.jdom.Document.  The web service
deploys on Tomcat (5.0.18) without any problems.  When I try to call the web
service from my test Java web app, I get the following exception:

exception is (500)Internal Server Error
AxisFault
 faultCode: {http://xml.apache.org/axis/}HTTP
 faultSubcode: 
 faultString: (500)Internal Server Error
 faultActor: 
 faultNode: 
 faultDetail: 
	{}string: return code:  500

Digging into this, I found what I think is the 'true' problem :
java.io.IOException: No serializer found for class org.jdom.Element in
registry org.apache.axis.encoding.TypeMappingImpl at 6c2308.  It appears that
although WSDL2JAVA converted the Document object to a proper bean, it didn't
do the Element object.  I not quite sure where to go from here, so if anyone
has some guidance, I'd sure appreciate it.  Better yet, if someone has a
working example of an Axis-based webservice using JDOM that they can share,
I'd also appreciate being able to get a look at it.

Thanks!

Jerry Jalenak
Development Manager, Web Publishing
LabOne, Inc.
10101 Renner Blvd.
Lenexa, KS  66219
(913) 577-1496

jerry.jalenak at labone.com


This transmission (and any information attached to it) may be confidential and
is intended solely for the use of the individual or entity to which it is
addressed. If you are not the intended recipient or the person responsible for
delivering the transmission to the intended recipient, be advised that you
have received this transmission in error and that any use, dissemination,
forwarding, printing, or copying of this information is strictly prohibited.
If you have received this transmission in error, please immediately notify
LabOne at the following email address: securityincidentreporting at labone.com




More information about the jdom-interest mailing list