axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 22204] New: - WS client throws wrong exception types
Date Thu, 07 Aug 2003 09:27:57 GMT
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();
  }

Mime
View raw message