|
From: Ronald v. K. <rv...@ab...> - 2003-04-02 22:39:43
|
Hi,
We've been looking into using apache-axis instead of the Sun
implementation of jaxm/saaj because it has more functionality (works
better with proxies, http keep-alive etc.) and is open-source. We've run
into one to many bug with the Sun libraries, that if we run into a bug,
we want to be able to fix it ourselves and give this back to the
community, hence freebxml, apache-axis, boucycastle for encryption etc...
One of my collegues initially concentrated on the
hk.hku.cecid.phoenix.message.packaging package andran into the following
problem.
hk.hku.cecid.phoenix.message.packaging.HeaderContainer, in
addExtensionElement(...):
--
if (extensionElement instanceof HeaderElement) {
final SOAPHeader soapHeader;
soapHeader = soapEnvelope.getHeader();
*
soapHeader.addChildElement*(extensionElement.getSOAPElement());
--
The last call shown above adds a SOAPElement to the header, which throws
an exeption in AXIS. The reason for this is in the code below. AXIS
expects this SOAPElement to be of type SOAPHeaderElement, which it is not.
org.apache.axis.message.SOAPHeader:
--
public SOAPElement* addChildElement*(SOAPElement element)
throws SOAPException
{
if (!(element instanceof* javax.xml.soap.SOAPHeaderElement*)) {
* throw new SOAPException*(Messages.getMessage("badSOAPHeader00"));
}
return super.addChildElement(element);
}
--
Since I'm not allowed to decompile the Sun implementation ;-) I tried
casting extensionElement.getSOAPElement() to SOAPHeaderElement, without
success. I get a classcast exception then in the default hermes (without
axis).
java.lang.ClassCastException:
com.sun.xml.messaging.saaj.soap.dom4j.ElementImpl
at
hk.hku.cecid.phoenix.message.packaging.HeaderContainer.addExtensionElement(HeaderContainer.java:296)
at
hk.hku.cecid.phoenix.message.packaging.EbxmlMessage.addMessageHeader(EbxmlMessage.java:343)
Maybe axis will work then, but the default hermes does not :-(
Any suggestion by anyone to get around this?
I do know however that all hermes uses standard extensionElements which
all are a SOAPElement.
|