wsld2java does not honor elementFormDefault="qualified" in XmlSchema annotation
-------------------------------------------------------------------------------

                 Key: CXF-1460
                 URL: https://issues.apache.org/jira/browse/CXF-1460
             Project: CXF
          Issue Type: Bug
          Components: Tooling
    Affects Versions: 2.0.4, 2.0.3
         Environment: Windows XP, Java Standard Edition 5.0
            Reporter: Artur Karazniewicz
            Priority: Blocker


java2wsdl does not honour elementFormDefault="qualified" attribute. Generated 
package-info.java does not have set attribute 
elementFormDefault=XmlNsForn.QUALIFIED.

See below example:

here is sample wsdl:

{code:xml}
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
        xmlns:tns="http://www.example.org/loanap/";
        xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
        xmlns:loanapp="http://www.example.org/loanap/types";
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"; name="loanap"
        targetNamespace="http://www.example.org/loanap/";>
        <wsdl:types>
                <xsd:schema
                        targetNamespace="http://www.example.org/loanap/types";
                        elementFormDefault="qualified" 
attributeFormDefault="unqualified">
                        <xsd:element name="aplication">
                                <xsd:complexType>
                                        <xsd:sequence>
                                                <xsd:element name="salary" 
type="xsd:decimal" />
                                                <xsd:element name="loan" 
type="xsd:decimal" />
                                        </xsd:sequence>
                                </xsd:complexType>
                        </xsd:element>
                        <xsd:element name="result">
                                <xsd:complexType>
                                        <xsd:sequence>
                                                <xsd:element name="commited" 
type="xsd:boolean" />
                                                <xsd:element name="amount" 
type="xsd:decimal" />
                                        </xsd:sequence>
                                </xsd:complexType>
                        </xsd:element>
                </xsd:schema>
        </wsdl:types>
        <wsdl:message name="applyRequest">
                <wsdl:part element="loanapp:aplication" name="parameters" />
        </wsdl:message>
        <wsdl:message name="applyResponse">
                <wsdl:part element="loanapp:result" name="parameters" />
        </wsdl:message>
        <wsdl:portType name="LoanService">
                <wsdl:operation name="apply">
                        <wsdl:input message="tns:applyRequest" />
                        <wsdl:output message="tns:applyResponse" />
                </wsdl:operation>
        </wsdl:portType>
        <wsdl:binding name="loanapSOAP" type="tns:LoanService">
                <soap:binding style="document"
                        transport="http://schemas.xmlsoap.org/soap/http"; />
                <wsdl:operation name="apply">
                        <soap:operation
                                
soapAction="http://www.example.org/loanap/NewOperation"; />
                        <wsdl:input>
                                <soap:body use="literal" />
                        </wsdl:input>
                        <wsdl:output>
                                <soap:body use="literal" />
                        </wsdl:output>
                </wsdl:operation>
        </wsdl:binding>
        <wsdl:service name="loanap">
                <wsdl:port binding="tns:loanapSOAP" name="LoanService">
                        <soap:address
                                
location="http://www.somebank.com/services/loanservice"; />
                </wsdl:port>
        </wsdl:service>
</wsdl:definitions>
{code}

I use {code}wsdl2java loanapp.wsdl{code} to generate Java artefacts and got 
package-info.java as below:

{code}
@javax.xml.bind.annotation.XmlSchema(namespace = 
"http://www.example.org/loanap/types";)
package org.example.loanap.types;
{code}

Note that, in above embedded XML Schema  I have 
{code}elementFormDefault="qualified{code} but in above
package-info it is not reflected. 

When Metro stack is used I got what expected:

{code}wsimport -Xnocompile loanap.wsdl{code}

gives:

{code}
@javax.xml.bind.annotation.XmlSchema(namespace = 
"http://www.example.org/loanap/types";, elementFormDefault = 
javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
package org.example.loanap.types;
{code}

What's interesting. When I use jaxb 2.0.5 (which seems to be used in CXF 2.0.4) 
and xjc I got exactly the same code as wsimport. 

It seems that's CXF bug, rather than JAXB RI. Also I consider this as a serius 
show stopper, since CXF will produce XML instances which are not valid against 
above schema (i.e. unqualified).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to