cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ulhas Bhole (JIRA)" <j...@apache.org>
Subject [jira] Commented: (CXF-3329) idl2wsdl: attributes of structs with the same name as a type do not show up in XSD
Date Mon, 14 Feb 2011 18:44:57 GMT

    [ 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

        

Mime
View raw message