You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Arnoud Glimmerveen (JIRA)" <ji...@apache.org> on 2011/02/11 15:22:58 UTC

[jira] Created: (CXF-3329) idl2wsdl: attributes of structs with the same name as a type do not show up in XSD

idl2wsdl: attributes of structs with the same name as a type do not show up in XSD
----------------------------------------------------------------------------------

                 Key: CXF-3329
                 URL: https://issues.apache.org/jira/browse/CXF-3329
             Project: CXF
          Issue Type: Bug
          Components: Tooling
    Affects Versions: 2.3.2, 2.3.3
            Reporter: Arnoud Glimmerveen


I am using idl2wsdl to generate a XML schema from a set of type definitions in IDL using the cxf-corbatools-maven-plugin. If the IDL has structures containing attributes with the same name as a type in the same IDL, that attribute does not show up in the generated XSD.

For example, the following IDL definition:

{code}
module myModule
{
	struct myStruct
	{
		long myStruct;
		long otherField;
	};
};
{code}

results in the XSD below:

{code:xml}
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://my.company.com" xmlns:tns="http://my.company.com" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:complexType name="myModule.myStruct">
    <xs:sequence>
      <xs:element name="otherField" type="xs:int">
      </xs:element>
    </xs:sequence>
  </xs:complexType>
</xs:schema>
{code}

The attribute myStruct from the IDL is not present in the XSD.

The output of idl2wsdl is as follows:

{noformat}
idl2wsdl -o path/to/output -x http://my.company.com -T types.xsd -verbose path/to/types.idl
idl2wsdl - Apache CXF 2.3.3-SNAPSHOT

 ( module myModule ( struct myStruct long myStruct long otherField ) )
{noformat}

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Issue Comment Edited: (CXF-3329) idl2wsdl: attributes of structs with the same name as a type do not show up in XSD

Posted by "Arnoud Glimmerveen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-3329?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12993596#comment-12993596 ] 

Arnoud Glimmerveen edited comment on CXF-3329 at 2/11/11 5:24 PM:
------------------------------------------------------------------

I attached the sample as IDL file. The attribute myStruct does not appear in the generated XSD.

      was (Author: arnoud):
    Sample IDL file, where attribute myStruct does not appear in the generated XSD.
  
> idl2wsdl: attributes of structs with the same name as a type do not show up in XSD
> ----------------------------------------------------------------------------------
>
>                 Key: CXF-3329
>                 URL: https://issues.apache.org/jira/browse/CXF-3329
>             Project: CXF
>          Issue Type: Bug
>          Components: Tooling
>    Affects Versions: 2.3.2, 2.3.3
>            Reporter: Arnoud Glimmerveen
>              Labels: idl2wsdl
>         Attachments: sample.idl
>
>
> I am using idl2wsdl to generate a XML schema from a set of type definitions in IDL using the cxf-corbatools-maven-plugin. If the IDL has structures containing attributes with the same name as a type in the same IDL, that attribute does not show up in the generated XSD.
> For example, the following IDL definition:
> {code}
> module myModule
> {
> 	struct myStruct
> 	{
> 		long myStruct;
> 		long otherField;
> 	};
> };
> {code}
> results in the XSD below:
> {code:xml}
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://my.company.com" xmlns:tns="http://my.company.com" xmlns:xs="http://www.w3.org/2001/XMLSchema">
>   <xs:complexType name="myModule.myStruct">
>     <xs:sequence>
>       <xs:element name="otherField" type="xs:int">
>       </xs:element>
>     </xs:sequence>
>   </xs:complexType>
> </xs:schema>
> {code}
> The attribute myStruct from the IDL is not present in the XSD.
> The output of idl2wsdl is as follows:
> {noformat}
> idl2wsdl -o path/to/output -x http://my.company.com -T types.xsd -verbose path/to/types.idl
> idl2wsdl - Apache CXF 2.3.3-SNAPSHOT
>  ( module myModule ( struct myStruct long myStruct long otherField ) )
> {noformat}

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (CXF-3329) idl2wsdl: attributes of structs with the same name as a type do not show up in XSD

Posted by "Ulhas Bhole (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-3329?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12994414#comment-12994414 ] 

Ulhas Bhole commented on CXF-3329:
----------------------------------

I had a initial look at the code and some debugging on the simple idl that from the example in this Jira and the issue here is while traversing the idl one of the checks is for forward reference of a type and in that case it recursively checks for the scope type subtracting one element from scope each time and type name. so it passes first phase where scope is myModule.myStruct.myStruct being not present in the scopeNames list however on the next cycle it tries to find myModule.myStruct in scopes and it finds the entry and treats it as forward reference. Here is the method that inturn calls a check isForwardReference() in ScopedNameVisitor.accept() call. if you look at the code it check for the scope removing one element at a time with the member name added to it. So in this case it will check for myModule.myStruct.myStruct then myModule.myStruct. 

{code}
    private void visitStructMembers(AST identifierNode, Struct struct,
                                    XmlSchemaSequence sequence,
                                    Scope structScope) {
        AST memberTypeNode = identifierNode.getNextSibling();
        while (memberTypeNode != null) {
            AST memberNode = TypesUtils.getCorbaTypeNameNode(memberTypeNode);
            
            XmlSchemaType schemaType = null;
            CorbaTypeImpl corbaType = null;
            Scope fqName = null;
            try {
                TypesVisitor visitor = new TypesVisitor(structScope,
                                                        definition,
                                                        schema,
                                                        wsdlVisitor,
                                                        null);
                visitor.visit(memberTypeNode);                
                schemaType = visitor.getSchemaType();
                corbaType = visitor.getCorbaType();
                fqName = visitor.getFullyQualifiedName();                
            } catch (Exception ex) {
                throw new RuntimeException(ex);
            }

            // Handle multiple struct member declarators
            // <declarators> :== <declarator> { "," <declarator> }*
            //
            // A multiple declarator must be an identifier (i.e. of type IDENT)
            // and cannot be a previous declared (or forward declared) type
            // (hence the ScopedNameVisitor.accept() call).
            while (memberNode != null
                   && memberNode.getType() == IDLTokenTypes.IDENT
                   && !ScopedNameVisitor.accept(structScope, definition, schema, memberNode, wsdlVisitor)) {

                XmlSchemaType memberSchemaType = schemaType;
                CorbaTypeImpl memberCorbaType = corbaType;
                // needed for anonymous arrays in structs 
                if (ArrayVisitor.accept(memberNode)) {
                    Scope anonScope = new Scope(structScope,
                                                TypesUtils.getCorbaTypeNameNode(memberTypeNode));
                    ArrayVisitor arrayVisitor = new ArrayVisitor(anonScope,
                                                                 definition,
                                                                 schema,
                                                                 wsdlVisitor,
                                                                 null,
                                                                 fqName);
                    arrayVisitor.setSchemaType(schemaType);
                    arrayVisitor.setCorbaType(corbaType);
                    arrayVisitor.visit(memberNode);
                    memberSchemaType = arrayVisitor.getSchemaType();
                    memberCorbaType = arrayVisitor.getCorbaType();
                    fqName = arrayVisitor.getFullyQualifiedName();
                }

                XmlSchemaElement member = 
                    createXmlSchemaElement(memberNode, memberSchemaType, fqName);
                sequence.getItems().add(member);           
                MemberType memberType = 
                    createMemberType(memberNode, memberCorbaType, fqName);            
                struct.getMember().add(memberType);
                
                memberNode = memberNode.getNextSibling();
            }
            
            memberTypeNode = memberNode;
        }
    }
{code}

> idl2wsdl: attributes of structs with the same name as a type do not show up in XSD
> ----------------------------------------------------------------------------------
>
>                 Key: CXF-3329
>                 URL: https://issues.apache.org/jira/browse/CXF-3329
>             Project: CXF
>          Issue Type: Bug
>          Components: Tooling
>    Affects Versions: 2.3.2, 2.3.3
>            Reporter: Arnoud Glimmerveen
>              Labels: idl2wsdl
>         Attachments: sample.idl
>
>
> I am using idl2wsdl to generate a XML schema from a set of type definitions in IDL using the cxf-corbatools-maven-plugin. If the IDL has structures containing attributes with the same name as a type in the same IDL, that attribute does not show up in the generated XSD.
> For example, the following IDL definition:
> {code}
> module myModule
> {
> 	struct myStruct
> 	{
> 		long myStruct;
> 		long otherField;
> 	};
> };
> {code}
> results in the XSD below:
> {code:xml}
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://my.company.com" xmlns:tns="http://my.company.com" xmlns:xs="http://www.w3.org/2001/XMLSchema">
>   <xs:complexType name="myModule.myStruct">
>     <xs:sequence>
>       <xs:element name="otherField" type="xs:int">
>       </xs:element>
>     </xs:sequence>
>   </xs:complexType>
> </xs:schema>
> {code}
> The attribute myStruct from the IDL is not present in the XSD.
> The output of idl2wsdl is as follows:
> {noformat}
> idl2wsdl -o path/to/output -x http://my.company.com -T types.xsd -verbose path/to/types.idl
> idl2wsdl - Apache CXF 2.3.3-SNAPSHOT
>  ( module myModule ( struct myStruct long myStruct long otherField ) )
> {noformat}

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Assigned] (CXF-3329) idl2wsdl: attributes of structs with the same name as a type do not show up in XSD

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-3329?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Kulp reassigned CXF-3329:
--------------------------------

    Assignee: Daniel Kulp
    
> idl2wsdl: attributes of structs with the same name as a type do not show up in XSD
> ----------------------------------------------------------------------------------
>
>                 Key: CXF-3329
>                 URL: https://issues.apache.org/jira/browse/CXF-3329
>             Project: CXF
>          Issue Type: Bug
>          Components: Tooling
>    Affects Versions: 2.3.2, 2.3.3
>            Reporter: Arnoud Glimmerveen
>            Assignee: Daniel Kulp
>              Labels: idl2wsdl
>             Fix For: 2.5.7, 2.6.4, 2.7.1
>
>         Attachments: sample.idl
>
>
> I am using idl2wsdl to generate a XML schema from a set of type definitions in IDL using the cxf-corbatools-maven-plugin. If the IDL has structures containing attributes with the same name as a type in the same IDL, that attribute does not show up in the generated XSD.
> For example, the following IDL definition:
> {code}
> module myModule
> {
> 	struct myStruct
> 	{
> 		long myStruct;
> 		long otherField;
> 	};
> };
> {code}
> results in the XSD below:
> {code:xml}
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://my.company.com" xmlns:tns="http://my.company.com" xmlns:xs="http://www.w3.org/2001/XMLSchema">
>   <xs:complexType name="myModule.myStruct">
>     <xs:sequence>
>       <xs:element name="otherField" type="xs:int">
>       </xs:element>
>     </xs:sequence>
>   </xs:complexType>
> </xs:schema>
> {code}
> The attribute myStruct from the IDL is not present in the XSD.
> The output of idl2wsdl is as follows:
> {noformat}
> idl2wsdl -o path/to/output -x http://my.company.com -T types.xsd -verbose path/to/types.idl
> idl2wsdl - Apache CXF 2.3.3-SNAPSHOT
>  ( module myModule ( struct myStruct long myStruct long otherField ) )
> {noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Resolved] (CXF-3329) idl2wsdl: attributes of structs with the same name as a type do not show up in XSD

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-3329?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Kulp resolved CXF-3329.
------------------------------

       Resolution: Fixed
    Fix Version/s: 2.7.1
                   2.6.4
                   2.5.7
    
> idl2wsdl: attributes of structs with the same name as a type do not show up in XSD
> ----------------------------------------------------------------------------------
>
>                 Key: CXF-3329
>                 URL: https://issues.apache.org/jira/browse/CXF-3329
>             Project: CXF
>          Issue Type: Bug
>          Components: Tooling
>    Affects Versions: 2.3.2, 2.3.3
>            Reporter: Arnoud Glimmerveen
>              Labels: idl2wsdl
>             Fix For: 2.5.7, 2.6.4, 2.7.1
>
>         Attachments: sample.idl
>
>
> I am using idl2wsdl to generate a XML schema from a set of type definitions in IDL using the cxf-corbatools-maven-plugin. If the IDL has structures containing attributes with the same name as a type in the same IDL, that attribute does not show up in the generated XSD.
> For example, the following IDL definition:
> {code}
> module myModule
> {
> 	struct myStruct
> 	{
> 		long myStruct;
> 		long otherField;
> 	};
> };
> {code}
> results in the XSD below:
> {code:xml}
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://my.company.com" xmlns:tns="http://my.company.com" xmlns:xs="http://www.w3.org/2001/XMLSchema">
>   <xs:complexType name="myModule.myStruct">
>     <xs:sequence>
>       <xs:element name="otherField" type="xs:int">
>       </xs:element>
>     </xs:sequence>
>   </xs:complexType>
> </xs:schema>
> {code}
> The attribute myStruct from the IDL is not present in the XSD.
> The output of idl2wsdl is as follows:
> {noformat}
> idl2wsdl -o path/to/output -x http://my.company.com -T types.xsd -verbose path/to/types.idl
> idl2wsdl - Apache CXF 2.3.3-SNAPSHOT
>  ( module myModule ( struct myStruct long myStruct long otherField ) )
> {noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Updated: (CXF-3329) idl2wsdl: attributes of structs with the same name as a type do not show up in XSD

Posted by "Arnoud Glimmerveen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-3329?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Arnoud Glimmerveen updated CXF-3329:
------------------------------------

    Attachment: sample.idl

Sample IDL file, where attribute myStruct does not appear in the generated XSD.

> idl2wsdl: attributes of structs with the same name as a type do not show up in XSD
> ----------------------------------------------------------------------------------
>
>                 Key: CXF-3329
>                 URL: https://issues.apache.org/jira/browse/CXF-3329
>             Project: CXF
>          Issue Type: Bug
>          Components: Tooling
>    Affects Versions: 2.3.2, 2.3.3
>            Reporter: Arnoud Glimmerveen
>              Labels: idl2wsdl
>         Attachments: sample.idl
>
>
> I am using idl2wsdl to generate a XML schema from a set of type definitions in IDL using the cxf-corbatools-maven-plugin. If the IDL has structures containing attributes with the same name as a type in the same IDL, that attribute does not show up in the generated XSD.
> For example, the following IDL definition:
> {code}
> module myModule
> {
> 	struct myStruct
> 	{
> 		long myStruct;
> 		long otherField;
> 	};
> };
> {code}
> results in the XSD below:
> {code:xml}
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://my.company.com" xmlns:tns="http://my.company.com" xmlns:xs="http://www.w3.org/2001/XMLSchema">
>   <xs:complexType name="myModule.myStruct">
>     <xs:sequence>
>       <xs:element name="otherField" type="xs:int">
>       </xs:element>
>     </xs:sequence>
>   </xs:complexType>
> </xs:schema>
> {code}
> The attribute myStruct from the IDL is not present in the XSD.
> The output of idl2wsdl is as follows:
> {noformat}
> idl2wsdl -o path/to/output -x http://my.company.com -T types.xsd -verbose path/to/types.idl
> idl2wsdl - Apache CXF 2.3.3-SNAPSHOT
>  ( module myModule ( struct myStruct long myStruct long otherField ) )
> {noformat}

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (CXF-3329) idl2wsdl: attributes of structs with the same name as a type do not show up in XSD

Posted by "Ulhas Bhole (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-3329?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12993572#comment-12993572 ] 

Ulhas Bhole commented on CXF-3329:
----------------------------------

Can you attach a sample idl file? I wouldn't mind having a quick look into it since I recently fixed similar duplicate attributes issue. 

> idl2wsdl: attributes of structs with the same name as a type do not show up in XSD
> ----------------------------------------------------------------------------------
>
>                 Key: CXF-3329
>                 URL: https://issues.apache.org/jira/browse/CXF-3329
>             Project: CXF
>          Issue Type: Bug
>          Components: Tooling
>    Affects Versions: 2.3.2, 2.3.3
>            Reporter: Arnoud Glimmerveen
>              Labels: idl2wsdl
>
> I am using idl2wsdl to generate a XML schema from a set of type definitions in IDL using the cxf-corbatools-maven-plugin. If the IDL has structures containing attributes with the same name as a type in the same IDL, that attribute does not show up in the generated XSD.
> For example, the following IDL definition:
> {code}
> module myModule
> {
> 	struct myStruct
> 	{
> 		long myStruct;
> 		long otherField;
> 	};
> };
> {code}
> results in the XSD below:
> {code:xml}
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://my.company.com" xmlns:tns="http://my.company.com" xmlns:xs="http://www.w3.org/2001/XMLSchema">
>   <xs:complexType name="myModule.myStruct">
>     <xs:sequence>
>       <xs:element name="otherField" type="xs:int">
>       </xs:element>
>     </xs:sequence>
>   </xs:complexType>
> </xs:schema>
> {code}
> The attribute myStruct from the IDL is not present in the XSD.
> The output of idl2wsdl is as follows:
> {noformat}
> idl2wsdl -o path/to/output -x http://my.company.com -T types.xsd -verbose path/to/types.idl
> idl2wsdl - Apache CXF 2.3.3-SNAPSHOT
>  ( module myModule ( struct myStruct long myStruct long otherField ) )
> {noformat}

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira