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 "Donal Fellows (JIRA)" <ax...@ws.apache.org> on 2005/08/08 14:48:39 UTC

[jira] Created: (AXIS-2168) Wrong handling of in faults in WSDL2Java

Wrong handling of <xsd:any> in faults in WSDL2Java
--------------------------------------------------

         Key: AXIS-2168
         URL: http://issues.apache.org/jira/browse/AXIS-2168
     Project: Apache Axis
        Type: Bug
  Components: WSDL processing  
    Reporter: Donal Fellows


When processing a WSDL document including a fault that is defined as a complex type that contains an xsd:any (for example, anything based on WS-BaseFaults; the specs are downloadable from http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=wsrf) the WSDL2Java generates incorrect code in the non-default constructor for the xsd:any content. This makes it impossible to use the generated code for such faults without first altering them all by hand, which is not very desirable. For example, see the followed output tooled from the BaseFaults spec with the CVS HEAD:

  public class BaseFaultType  extends org.apache.axis.AxisFault  implements java.io.Serializable, org.apache.axis.encoding.AnyContentType {
    // ..... ignoring other fields, which are all correct anyway .....
    // ..... this declaration is correct .....
    private org.apache.axis.message.MessageElement [] _any;
    // ..... ignoring more irrelevant stuff .....
    public BaseFaultType(
           java.util.Calendar timestamp,
           org.apache.axis.message.addressing.EndpointReferenceType originator,
           org.oasis.wsrf.bf.BaseFaultTypeErrorCode errorCode,
           org.oasis.wsrf.bf.BaseFaultTypeDescription[] description,
           org.oasis.wsrf.bf.BaseFaultTypeFaultCause faultCause,
           org.w3.www._2001.XMLSchema.Any any) {
        this.timestamp = timestamp;
        this.originator = originator;
        this.errorCode = errorCode;
        this.description = description;
        this.faultCause = faultCause;
        this.any = any;
    }
    // ..... the rest of the class is correct .....

As you can see, the _any field is declared correctly, but the code in the non-default constructor to assign to it is wrong (wrong field name and wrong type).

I've tracked this down to axis/src/org/apache/axis/wsdl/toJava/JavaBeanWriter.java and the fact that the writeFullConstructor() method does not use the contents of the names vector, unlike the writeMemberFields() or writeMinimalConstructor() methods.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (AXIS-2168) Wrong handling of in faults in WSDL2Java

Posted by "Donal Fellows (JIRA)" <ax...@ws.apache.org>.
     [ http://issues.apache.org/jira/browse/AXIS-2168?page=all ]

Donal Fellows updated AXIS-2168:
--------------------------------

    Attachment: anyInFault.diff

Here's a suggested patch to fix this bug (which seems to do the right thing when I test it on my WSDLs).
It could be slightly more minimal I suppose, but I don't like scattering constant strings all over code when I can use an informative symbol name instead.

> Wrong handling of <xsd:any> in faults in WSDL2Java
> --------------------------------------------------
>
>          Key: AXIS-2168
>          URL: http://issues.apache.org/jira/browse/AXIS-2168
>      Project: Apache Axis
>         Type: Bug
>   Components: WSDL processing
>     Reporter: Donal Fellows
>  Attachments: anyInFault.diff
>
> When processing a WSDL document including a fault that is defined as a complex type that contains an xsd:any (for example, anything based on WS-BaseFaults; the specs are downloadable from http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=wsrf) the WSDL2Java generates incorrect code in the non-default constructor for the xsd:any content. This makes it impossible to use the generated code for such faults without first altering them all by hand, which is not very desirable. For example, see the followed output tooled from the BaseFaults spec with the CVS HEAD:
>   public class BaseFaultType  extends org.apache.axis.AxisFault  implements java.io.Serializable, org.apache.axis.encoding.AnyContentType {
>     // ..... ignoring other fields, which are all correct anyway .....
>     // ..... this declaration is correct .....
>     private org.apache.axis.message.MessageElement [] _any;
>     // ..... ignoring more irrelevant stuff .....
>     public BaseFaultType(
>            java.util.Calendar timestamp,
>            org.apache.axis.message.addressing.EndpointReferenceType originator,
>            org.oasis.wsrf.bf.BaseFaultTypeErrorCode errorCode,
>            org.oasis.wsrf.bf.BaseFaultTypeDescription[] description,
>            org.oasis.wsrf.bf.BaseFaultTypeFaultCause faultCause,
>            org.w3.www._2001.XMLSchema.Any any) {
>         this.timestamp = timestamp;
>         this.originator = originator;
>         this.errorCode = errorCode;
>         this.description = description;
>         this.faultCause = faultCause;
>         this.any = any;
>     }
>     // ..... the rest of the class is correct .....
> As you can see, the _any field is declared correctly, but the code in the non-default constructor to assign to it is wrong (wrong field name and wrong type).
> I've tracked this down to axis/src/org/apache/axis/wsdl/toJava/JavaBeanWriter.java and the fact that the writeFullConstructor() method does not use the contents of the names vector, unlike the writeMemberFields() or writeMinimalConstructor() methods.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (AXIS-2168) Wrong handling of in faults in WSDL2Java

Posted by "Davanum Srinivas (JIRA)" <ax...@ws.apache.org>.
    [ http://issues.apache.org/jira/browse/AXIS-2168?page=comments#action_12319550 ] 

Davanum Srinivas commented on AXIS-2168:
----------------------------------------

Could you please help with a patch against latest CVS?

thanks,
dims

> Wrong handling of <xsd:any> in faults in WSDL2Java
> --------------------------------------------------
>
>          Key: AXIS-2168
>          URL: http://issues.apache.org/jira/browse/AXIS-2168
>      Project: Apache Axis
>         Type: Bug
>   Components: WSDL processing
>     Reporter: Donal Fellows

>
> When processing a WSDL document including a fault that is defined as a complex type that contains an xsd:any (for example, anything based on WS-BaseFaults; the specs are downloadable from http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=wsrf) the WSDL2Java generates incorrect code in the non-default constructor for the xsd:any content. This makes it impossible to use the generated code for such faults without first altering them all by hand, which is not very desirable. For example, see the followed output tooled from the BaseFaults spec with the CVS HEAD:
>   public class BaseFaultType  extends org.apache.axis.AxisFault  implements java.io.Serializable, org.apache.axis.encoding.AnyContentType {
>     // ..... ignoring other fields, which are all correct anyway .....
>     // ..... this declaration is correct .....
>     private org.apache.axis.message.MessageElement [] _any;
>     // ..... ignoring more irrelevant stuff .....
>     public BaseFaultType(
>            java.util.Calendar timestamp,
>            org.apache.axis.message.addressing.EndpointReferenceType originator,
>            org.oasis.wsrf.bf.BaseFaultTypeErrorCode errorCode,
>            org.oasis.wsrf.bf.BaseFaultTypeDescription[] description,
>            org.oasis.wsrf.bf.BaseFaultTypeFaultCause faultCause,
>            org.w3.www._2001.XMLSchema.Any any) {
>         this.timestamp = timestamp;
>         this.originator = originator;
>         this.errorCode = errorCode;
>         this.description = description;
>         this.faultCause = faultCause;
>         this.any = any;
>     }
>     // ..... the rest of the class is correct .....
> As you can see, the _any field is declared correctly, but the code in the non-default constructor to assign to it is wrong (wrong field name and wrong type).
> I've tracked this down to axis/src/org/apache/axis/wsdl/toJava/JavaBeanWriter.java and the fact that the writeFullConstructor() method does not use the contents of the names vector, unlike the writeMemberFields() or writeMinimalConstructor() methods.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira