Bug 901318 (JBPAPP6-1783) - Fix ordering of properties in exception types
Summary: Fix ordering of properties in exception types
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: JBPAPP6-1783
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: Web Services
Version: 6.0.1
Hardware: Unspecified
OS: Unspecified
urgent
high
Target Milestone: ER1
: EAP 6.4.0
Assignee: Alessio Soldano
QA Contact:
URL: http://jira.jboss.org/jira/browse/JBP...
Whiteboard:
Depends On:
Blocks: 1168630
TreeView+ depends on / blocked
 
Reported: 2013-01-11 18:41 UTC by Kyle Lape
Modified: 2019-08-02 07:30 UTC (History)
11 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2019-08-02 07:30:24 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
test code (76.20 KB, application/zip)
2014-11-06 02:39 UTC, Rebecca Searls
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Apache JIRA CXF-6089 0 None None None Never
Red Hat Issue Tracker JBPAPP6-1783 0 Major Closed Fix ordering of properties in exception types 2015-06-10 22:20:03 UTC

Description Kyle Lape 2013-01-11 18:41:41 UTC
project_key: JBPAPP6

Comment 1 Kyle Lape 2013-01-11 22:41:18 UTC
RemoteIssueLink: Added: This issue links to "CXF-4729 (Apache JIRA)"


Comment 2 Kyle Lape 2013-01-11 22:41:18 UTC
RemoteIssueLink: Added: This issue links to "CXF-4680 (Apache JIRA)"


Comment 3 Rostislav Svoboda 2013-02-22 12:19:05 UTC
CXF-4729 and CXF-4680 were fixed in 2.6.5, EAP 6.1.0 contains 2.6.6

Does it mean it's resolved ? If yes, please set proper Status to ON_QA ans select proper Target Release

Comment 6 Rostislav Svoboda 2013-09-03 07:56:03 UTC
Using the same app I used for https://issues.jboss.org/browse/JBPAPP-10835

WSDL is fine:
    <xs:complexType name="WSInstructionCreationException">
    <xs:sequence>
    <xs:element name="aValue" nillable="true" type="xs:string"/>
    <xs:element name="detail" nillable="true" type="xs:string"/>
    <xs:element name="info1" nillable="true" type="xs:string"/>
    <xs:element name="info2" nillable="true" type="xs:string"/>
    <xs:element name="instruction" nillable="true" type="xs:string"/>
    <xs:element name="intVal" nillable="true" type="xs:int"/>
    <xs:element name="message" nillable="true" type="xs:string"/>
    <xs:element name="messageKey" nillable="true" type="xs:string"/>
    </xs:sequence>
    </xs:complexType>

SAOP response in NOT fine:
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
       <soap:Body>
          <soap:Fault>
             <faultcode>soap:Server</faultcode>
             <faultstring>Error message</faultstring>
             <detail>
                <ns1:WSInstructionCreationException xmlns:ns1="http://ws.arte.lodh.com/cxf">
                   <detail xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://ws.arte.lodh.com/cxf"/>
                   <message xmlns="http://ws.arte.lodh.com/cxf">Error message</message>
                   <instruction xmlns="http://ws.arte.lodh.com/cxf">instr</instruction>
                   <info1 xmlns="http://ws.arte.lodh.com/cxf">myInfo1</info1>
                   <info2 xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://ws.arte.lodh.com/cxf"/>
                   <messageKey xmlns="http://ws.arte.lodh.com/cxf">msg key</messageKey>
                   <aValue xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://ws.arte.lodh.com/cxf"/>
                   <intVal xsi:type="xs:int" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://ws.arte.lodh.com/cxf">0</intVal>
                </ns1:WSInstructionCreationException>
             </detail>
          </soap:Fault>
       </soap:Body>
    </soap:Envelope>

Comment 8 Rostislav Svoboda 2013-09-04 09:15:34 UTC
https://issues.apache.org/jira/browse/CXF-5163 is fixed in CXF 2.7.6 which should be included in EAP 6.2.0 ER1.

Moving to POST, Alessio is aware.

Comment 13 Rostislav Svoboda 2014-02-19 09:56:51 UTC
Checking per Jimmy's request via email. This issue never made it back to ON_QA after FailedQA - Comment 6. Checking on EAP 6.2.0 GA.

WSDL is NOT fine:
  <xs:complexType name="WSInstructionCreationException">
    <xs:sequence>
      <xs:element name="aValue" nillable="true" type="xs:string"/>
      <xs:element name="detail" nillable="true" type="xs:string"/>
      <xs:element name="info1" nillable="true" type="xs:string"/>
      <xs:element name="info2" nillable="true" type="xs:string"/>
      <xs:element name="instruction" nillable="true" type="xs:string"/>
      <xs:element name="intVal" nillable="true" type="xs:int"/>
      <xs:element name="message" nillable="true" type="xs:string"/>
      <xs:element minOccurs="0" name="message" type="xs:string"/>
      <xs:element name="messageKey" nillable="true" type="xs:string"/>
    </xs:sequence>
  </xs:complexType>

Problematic part is duplicated line for name="message":
      <xs:element name="message" nillable="true" type="xs:string"/>
      <xs:element minOccurs="0" name="message" type="xs:string"/>


SOAP response is fine:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <soap:Fault>
         <faultcode>soap:Server</faultcode>
         <faultstring>Error message</faultstring>
         <detail>
            <ns1:WSInstructionCreationException xmlns:ns1="http://ws.arte.lodh.com/cxf">
               <aValue xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://ws.arte.lodh.com/cxf"/>
               <detail xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://ws.arte.lodh.com/cxf"/>
               <info1 xmlns="http://ws.arte.lodh.com/cxf">myInfo1</info1>
               <info2 xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://ws.arte.lodh.com/cxf"/>
               <instruction xmlns="http://ws.arte.lodh.com/cxf">instr</instruction>
               <intVal xsi:type="xs:int" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://ws.arte.lodh.com/cxf">0</intVal>
               <message xmlns="http://ws.arte.lodh.com/cxf">Error message</message>
               <messageKey xmlns="http://ws.arte.lodh.com/cxf">msg key</messageKey>
            </ns1:WSInstructionCreationException>
         </detail>
      </soap:Fault>
   </soap:Body>
</soap:Envelope>

Comment 14 Rebecca Searls 2014-10-30 12:06:46 UTC
This is a reposting of comments based upon an evaluation 
I'm using this bld env.  Is it the correct one for 6.4.0?
  upstream	https://github.com/jbossas/jboss-eap.git 
  remotes/upstream/6.x
In this branch the pom.xml is using apache CXF version 2.7.11.redhat-3.
I am getting different output from that described above.

Using wireshark I got the correct value order in the returned msg.

    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
      <soap:Body><soap:Fault>
        <faultcode>soap:Server</faultcode>
        <faultstring>Error message</faultstring>
          <detail>
            <ns1:WSInstructionCreationException xmlns:ns1="http://ws.arte.lodh.com/cxf">
              <aValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://ws.arte.lodh.com/cxf" xsi:nil="true"/>
              <detail xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://ws.arte.lodh.com/cxf" xsi:nil="true"/>
              <info1 xmlns="http://ws.arte.lodh.com/cxf">myInfo1</info1>
              <info2 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://ws.arte.lodh.com/cxf" xsi:nil="true"/>
              <instruction xmlns="http://ws.arte.lodh.com/cxf">instr</instruction>
              <intVal xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://ws.arte.lodh.com/cxf" xsi:type="xs:int">0</intVal>
              <message xmlns="http://ws.arte.lodh.com/cxf">Error message</message>
              <messageKey xmlns="http://ws.arte.lodh.com/cxf">msg key</messageKey>
            </ns1:WSInstructionCreationException>

            <stackTrace xmlns="http://cxf.apache.org/fault">com.lodh.cxf.WSInstructionCreationException#@#: 
            com.lodh.cxf.MyWebService!throwException!MyWebService.java!39#*#sun.reflect.NativeMethodAccessorImpl!invoke0!NativeMethodAccessorImpl.java!-2#*#sun.reflect.NativeMethodAccessorImpl!invoke!NativeMethodAccessorImpl.java!57#*#sun.reflect.DelegatingMethodAccessorImpl!invoke!DelegatingMethodAccessorImpl.java!43#*#
.... </stackTrace>
          </detail>
        </soap:Fault>
      </soap:Body>
    </soap:Envelope>

However I did not get correct data generated in the wsdl. (dup message elements)

    <xs:complexType name="WSInstructionCreationException">
      <xs:sequence>
        <xs:element minOccurs="0" name="aValue" type="xs:string"/>
        <xs:element minOccurs="0" name="detail" type="xs:string"/>
        <xs:element minOccurs="0" name="info1" type="xs:string"/>
        <xs:element minOccurs="0" name="info2" type="xs:string"/>
        <xs:element minOccurs="0" name="instruction" type="xs:string"/>
        <xs:element minOccurs="0" name="intVal" type="xs:int"/>
>>        <xs:element minOccurs="0" name="message" type="xs:string"/>
>>        <xs:element minOccurs="0" name="message" type="xs:string"/>
        <xs:element minOccurs="0" name="messageKey" type="xs:string"/>
      </xs:sequence>
    </xs:complexType>

It appears as Kyle Lape noted on 2013-09-03 20:31:08 that the 2 fixes weren't 
fixed at the same time.  The The WSDL ordering is NOT fixed via CXF-4729 in
this version however the SOAP message ordering IS fixed (CXF-5163).

Would someone confirm I am using the right repo ref.

Comment 16 Rebecca Searls 2014-11-06 02:36:32 UTC
Retested with current 6.x.
Still failing in wsdl generation.

steps to reproduce
  repo: https://github.com/jbossas/jboss-eap.git
  branch: checkout branch 6.x
  build
  Use test app bz901318App-test-code.zip  (see attached)
  cd  bz901318App 
ant deploy -Djboss.home=<USER-HOME>/jboss-eap/build/target/jboss-as-7.5.0.Final-redhat-SNAPSHOT
java -jar target/bz-901318-app-1.0.jar org.jbossws.Client
view <USER-HOME>/jboss-eap/build/target/jboss-as-7.5.0.Final-redhat-SNAPSHOT/standalone/data/wsdl/test.war/MyWebService.wsdl
ant undeploy -Djboss.home=<USER-HOME>/jboss-eap/build/target/jboss-as-7.5.0.Final-redhat-SNAPSHOT

------ results -------------
  <xs:complexType name="WSInstructionCreationException">
    <xs:sequence>
      <xs:element minOccurs="0" name="aValue" type="xs:string"/>
      <xs:element minOccurs="0" name="detail" type="xs:string"/>
      <xs:element minOccurs="0" name="info1" type="xs:string"/>
      <xs:element minOccurs="0" name="info2" type="xs:string"/>
      <xs:element minOccurs="0" name="instruction" type="xs:string"/>
      <xs:element minOccurs="0" name="intVal" type="xs:int"/>
 >>     <xs:element minOccurs="0" name="message" type="xs:string"/>
 >>     <xs:element minOccurs="0" name="message" type="xs:string"/>
      <xs:element minOccurs="0" name="messageKey" type="xs:string"/>
    </xs:sequence>
  </xs:complexType>

Comment 17 Rebecca Searls 2014-11-06 02:39:42 UTC
Created attachment 954260 [details]
test code

Comment 18 Rebecca Searls 2014-11-06 20:55:33 UTC
Testing with 6.x branch in https://github.com/jbossas/jboss-eap/
This version is using CXF <version.org.apache.cxf>2.7.13</version.org.apache.cxf>

The cause of duplicate message elements being listed in the generated WSDL
is a duplication of the processing of "cls" by Utils.getGetters at line
562 and addExceptionMessage() at line 587. Utils.getGetters checks for an 
Exception class defining method, getMessage.  If method, "getMessage" is NOT 
annotated with @XmlTransient it is returned as a method to be processed and 
added to "seq" (lines 575-581) .  A similar evaluation is performed by 
addExceptionMessage().  It adds a second ref to "getMessage" to "seq" when 
@XmlTransient is not present on the method, hence the duplicate elements in 
the WSDL.   

This same basic code exists back to version (2.6.x-fixes)
  http://svn.apache.org/repos/asf/cxf/branches/2.6.x-fixes
I did not check version prior to that.

-----
org.apache.cxf.jaxb.JAXBSchemaInitializer

  562        for (Method m : Utils.getGetters(cls, accessType)) {
  ..........
  575                JAXBBeanInfo beanInfo = getBeanInfo(type);
  576                if (beanInfo != null) {
  577                    int idx = m.getName().startsWith("get") ? 3 : 2;
  578                    String name = m.getName().substring(idx);
  579                    name = Character.toLowerCase(name.charAt(0)) + name.substring(1);
  580                    XmlElement  xmlElementAnno =  m.getAnnotation(XmlElement.class);
  581                    addElement(schema, seq, beanInfo, new QName(namespace, name), isArray(type), xmlElementAnno);
                  }
              }
          }
          // Create element in xsd:sequence for Exception.class
          if (Exception.class.isAssignableFrom(cls)) {
  587            addExceptionMessage(cls, schema, seq);
          }

-----
org.apache.cxf.jaxb.JAXBSchemaInitializer

      private void addExceptionMessage(Class<?> cls, XmlSchema schema, XmlSchemaSequence seq) {
          try {
              //a subclass could mark the message method as transient
  611            Method m = cls.getMethod("getMessage");
  612            if (!m.isAnnotationPresent(XmlTransient.class)) {
                  JAXBBeanInfo beanInfo = getBeanInfo(java.lang.String.class);
                  XmlSchemaElement exEle = new XmlSchemaElement(schema, false);
                  exEle.setName("message");
                  exEle.setSchemaTypeName(getTypeName(beanInfo));
                  exEle.setMinOccurs(0);
  618                seq.getItems().add(exEle);
              }
          } catch (Exception e) {
              //ignore, just won't have the message element
          }


-----
org.apache.cxf.jaxb.Utils
  121        if (method.isBridge()
  122                || Modifier.isStatic(method.getModifiers())
  123 >>               || method.isAnnotationPresent(XmlTransient.class)
  124                || method.getDeclaringClass().equals(Throwable.class)
  125                || "getClass".equals(method.getName())) {
  126            return false;
          }

Comment 19 Rebecca Searls 2014-11-06 20:56:55 UTC
I created https://issues.apache.org/jira/browse/CXF-6089 and provided patch for
cxf-2.7.13.

Comment 21 Jan Blizňák 2015-01-13 15:39:08 UTC
Verified on 6.4.0.ER1


WSDL:
<xs:element name="WSInstructionCreationException" type="tns:WSInstructionCreationException"/>
<xs:complexType name="WSInstructionCreationException">
  <xs:sequence>
    <xs:element minOccurs="0" name="aValue" type="xs:string"/>
    <xs:element minOccurs="0" name="detail" type="xs:string"/>
    <xs:element minOccurs="0" name="info1" type="xs:string"/>
    <xs:element minOccurs="0" name="info2" type="xs:string"/>
    <xs:element minOccurs="0" name="instruction" type="xs:string"/>
    <xs:element minOccurs="0" name="intVal" type="xs:int"/>
    <xs:element minOccurs="0" name="message" type="xs:string"/>
    <xs:element minOccurs="0" name="messageKey" type="xs:string"/>
  </xs:sequence>
</xs:complexType>

SOAP:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <soap:Fault>
         <faultcode>soap:Server</faultcode>
         <faultstring>Error message</faultstring>
         <detail>
            <ns1:WSInstructionCreationException xmlns:ns1="http://ws.arte.lodh.com/cxf">
               <aValue xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://ws.arte.lodh.com/cxf"/>
               <detail xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://ws.arte.lodh.com/cxf"/>
               <info1 xmlns="http://ws.arte.lodh.com/cxf">myInfo1</info1>
               <info2 xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://ws.arte.lodh.com/cxf"/>
               <instruction xmlns="http://ws.arte.lodh.com/cxf">instr</instruction>
               <intVal xsi:type="xs:int" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://ws.arte.lodh.com/cxf">0</intVal>
               <message xmlns="http://ws.arte.lodh.com/cxf">Error message</message>
               <messageKey xmlns="http://ws.arte.lodh.com/cxf">msg key</messageKey>
            </ns1:WSInstructionCreationException>
         </detail>
      </soap:Fault>
   </soap:Body>
</soap:Envelope>


Note You need to log in before you can comment on or make changes to this bug.