You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by bu...@apache.org on 2003/08/07 11:27:57 UTC
DO NOT REPLY [Bug 22204] New: -
WS client throws wrong exception types
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22204>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22204
WS client throws wrong exception types
Summary: WS client throws wrong exception types
Product: Axis
Version: 1.1
Platform: All
OS/Version: All
Status: NEW
Severity: Major
Priority: Other
Component: Basic Architecture
AssignedTo: axis-dev@ws.apache.org
ReportedBy: joern.gebhardt@ptv.de
When a SOAP fault message gets deserialized the exception type that is thrown
is primarily based on the faults qname instead of the xmlType. As a consequence
wrong exception classes can be thrown because different exceptions can have the
same qname (maybe that is the fault?).
EXAMPLE:
The SOAPBindingStub (generated out of the WSDL) contains code like this for
defining an operation:
oper.addFault(
new org.apache.axis.description.FaultDesc(
new javax.xml.namespace.QName("http://abc.de", "fault"),
"de.abc.MyException",
new javax.xml.namespace.QName("http://abc.de", "MyException"),
true));
oper.addFault(
new org.apache.axis.description.FaultDesc(
new javax.xml.namespace.QName("http://abc.de", "fault"),
"de.abc.xy.AnotherException",
new javax.xml.namespace.QName("http://xy.abc.de", "AnotherException"),
true));
As you can see do there exist two different exceptions that have the same qname
QName("http://abc.de", "fault")
The class org.apache.axis.message.SOAPFaultDetailsBuilder gets in the
method "onStartChild(..)" the fault by the QName. Because both exceptins have
the same qname one of them is picked, which might be the wrong one.
Instead the xmlType should be taken.
I.e. the code section:
FaultDesc faultDesc = op.getFaultByQName(qn);
// allow fault type to be denoted in xsi:type
if (faultDesc == null) {
faultXmlType = context.getTypeFromAttributes(namespace,
name,
attributes);
if (faultXmlType != null) {
faultDesc = op.getFaultByXmlType(faultXmlType);
}
} else {
faultXmlType = faultDesc.getXmlType();
}
should be changed to:
FaultDesc faultDesc = null;
// allow fault type to be denoted in xsi:type
faultXmlType = context.getTypeFromAttributes(namespace,
name,
attributes);
if (faultXmlType != null) {
faultDesc = op.getFaultByXmlType(faultXmlType);
}
if (faultDesc == null) {
faultDesc = op.getFaultByQName(qn);
faultXmlType = faultDesc.getXmlType();
}