Uploaded image for project: 'JBoss Web Services'
  1. JBoss Web Services
  2. JBWS-477

Erroneous 'message' element when serializing service specific exceptions

XMLWordPrintable

      There's a bug in the behaviour of JBoss with regard to serializing service-specific exceptions. Regardless of the exception's JavaBean properties, its XML Schema definition, and exception- and java-xml-type- mapping information supplied, JBoss always adds a gratuitous 'message' element, whereby making the model content of the soapenv:Fault's detail element non-conforming to the the service-specific exception's schema and leading to interoperability issues.

      Below is an example of an envelope returned by JBoss:

      <?xml version="1.0" encoding="UTF-8"?>
      <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <soapenv:Body>
      <soapenv:Fault>
      <faultcode>soapenv:Client</faultcode>
      <faultstring>Error</faultstring>
      <detail>
      <ns1:AlturaException xmlns:ns1="http://application.alturadev.compuware.com">
      <message>Error</message>
      <key>ERR_GenericException</key>
      <values xsi:nil="1"/>
      </ns1:AlturaException>
      </detail>
      </soapenv:Fault>
      </soapenv:Body>
      </soapenv:Envelope>

      The corresponding XML Schema excetpt looks like this:
      <xsd:complexType name="AlturaException">
      <xsd:sequence>
      <xsd:element name="key" type="xsd:string"/>
      <xsd:element name="values" type="xsd:string" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
      </xsd:sequence>
      </xsd:complexType>

      The relevant portion of the JAX-RPC mapping DD is:
      <java-xml-type-mapping>
      <java-type>com.compuware.alturadev.application.AlturaException</java-type>
      <root-type-qname xmlns:typeNS="http://application.alturadev.compuware.com">typeNS:AlturaException</root-type-qname>
      <qname-scope>complexType</qname-scope>
      <variable-mapping>
      <java-variable-name>key</java-variable-name>
      <xml-element-name>key</xml-element-name>
      </variable-mapping>
      <variable-mapping>
      <java-variable-name>values</java-variable-name>
      <xml-element-name>values</xml-element-name>
      </variable-mapping>
      </java-xml-type-mapping>

      I've been wrestling with this problem in JBoss 4.0.2 for about two hours before I devcided to consult the relevant source code. I've found the following code(org/jboss/axis/utils/BeanInfo.java, Line 155):

      // Include the message property
      if (isThrowable)

      { List bpList = new ArrayList(); bpList.add(new PropertyDescriptor("message", Throwable.class, "getMessage", null)); bpList.addAll(Arrays.asList(result)); result = new PropertyDescriptor[bpList.size()]; bpList.toArray(result); }

      this explains why JBoss always disregards XML Schema, exception- and java-xml-type- mapping information and serializes this element. As a matter of fact this non-conformant behaviour is discontinued as of Axis 1.2.

      Hope this helps.

      Regards,
      Andrei.

            tdiesler@redhat.com Thomas Diesler
            ilchen_jira Andrei Iltchenko (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: