Generating source from wsdl2java does not respect namespace of complexTypes in
included schema.
-----------------------------------------------------------------------------------------------
Key: CXF-1934
URL: https://issues.apache.org/jira/browse/CXF-1934
Project: CXF
Issue Type: Bug
Affects Versions: 2.1.3
Reporter: Derek
Priority: Minor
When generating classes via wsdl2java, the JAXB generated classes for complex
types in the schema section do not reflect the correct namespace. For example,
generating code from the WSDL below:
<wsdl:definitions xmlns="http://example.org/math/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:y="http://example.org/math/"
xmlns:type="http://example.org/math/types/"
targetNamespace="http://example.org/math/">
<wsdl:types>
<xs:schema xmlns="http://example.org/math/types/"
targetNamespace="http://example.org/math/types/">
<xs:complexType name="MathInput">
<xs:sequence>
<xs:element name="x" type="xs:double" />
<xs:element name="z" type="xs:double" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="MathOutput">
<xs:sequence>
<xs:element name="result"
type="xs:double" />
</xs:sequence>
</xs:complexType>
<xs:element name="Add" type="type:MathInput" />
<xs:element name="AddResponse" type="type:MathOutput" />
<xs:element name="Subtract" type="type:MathInput" />
<xs:element name="SubtractResponse"
type="type:MathOutput" />
</xs:schema>
</wsdl:types>
<wsdl:message name="AddMessage">
<wsdl:part name="parameters" element="type:Add" />
</wsdl:message>
<wsdl:message name="AddResponseMessage">
<wsdl:part name="parameters" element="type:AddResponse" />
</wsdl:message>
<wsdl:message name="SubtractMessage">
<wsdl:part name="parameters" element="type:Subtract" />
</wsdl:message>
<wsdl:message name="SubtractResponseMessage">
<wsdl:part name="parameters" element="type:SubtractResponse" />
</wsdl:message>
<wsdl:portType name="MathInterface">
<wsdl:operation name="Add">
<wsdl:input message="y:AddMessage" />
<wsdl:output message="y:AddResponseMessage" />
</wsdl:operation>
<wsdl:operation name="Subtract">
<wsdl:input message="y:SubtractMessage" />
<wsdl:output message="y:SubtractResponseMessage" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="MathSoapHttpBinding" type="y:MathInterface">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="Add">
<soap:operation
soapAction="http://example.org/math/#Add" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="Subtract">
<soap:operation
soapAction="http://example.org/math/#Subtract" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="MathService">
<wsdl:port name="MathEndpoint" binding="y:MathSoapHttpBinding">
<soap:address
location="http://localhost/math/math.asmx" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
results in JAXB classes with no namespaces. For example, MathInput should be in
namespace ttp://example.org/math/types/. The @XmlType declaration in
MathInput.java look like:
@XmlType(name = "MathInput", propOrder = {
"x",
"z"
})
with no namespace entry. Running the generated code results in the following
errors on CXF startup (in this case from Mule):
14:32:04,606 ERROR [STDERR] Dec 7, 2008 2:32:04 PM org.apache.cxf.service.factor
y.ReflectionServiceFactoryBean fillInSchemaCrossreferences
SEVERE: Schema element {http://example.org/math/types/}SubtractResponse referenc
es undefined type MathOutput for service {http://example.org/math/}MathInterface
Service.
14:32:04,606 ERROR [STDERR] Dec 7, 2008 2:32:04 PM org.apache.cxf.service.factor
y.ReflectionServiceFactoryBean fillInSchemaCrossreferences
SEVERE: Schema element {http://example.org/math/types/}Subtract references undef
ined type MathInput for service {http://example.org/math/}MathInterfaceService.
14:32:04,621 ERROR [STDERR] Dec 7, 2008 2:32:04 PM org.apache.cxf.service.factor
y.ReflectionServiceFactoryBean fillInSchemaCrossreferences
SEVERE: Schema element {http://example.org/math/types/}AddResponse references un
defined type MathOutput for service {http://example.org/math/}MathInterfaceServi
ce.
14:32:04,621 ERROR [STDERR] Dec 7, 2008 2:32:04 PM org.apache.cxf.service.factor
y.ReflectionServiceFactoryBean fillInSchemaCrossreferences
SEVERE: Schema element {http://example.org/math/types/}Add references undefined
type MathInput for service {http://example.org/math/}MathInterfaceService.
.. and the WSDL served by CXF relects two 'xs:schema' (one for elements and a
separate for the complex types) with different targetNamespaces. Adding the
namespace declaration to the JXC-generated sources for the complexTypes fixes
the problem.
Thanks,
Derek
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.