Derek Adams wrote:
> Sorry for the formatting problems. Let me try that again:
> 
> <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:definitions>
> 
> If you run this through java2wsdl, notice that there are no namespaces on the 
> MathInput and MathOutput elements.

Maybe I miss something here, but I tried to generate the code from the
example WSDL you included in your mail and I get the correct namespaces
with CXF 2.1.3. If you generate the code with java2wsdl the namespace
information is not on the generated classes but inside the
package-info.java:

@javax.xml.bind.annotation.XmlSchema(namespace =
"http://example.org/math/types/";)
package org.example.math.types;

The classes inside the package inherit the XML-namespace specified on
the package-level.

I used the generated code to create a WSDL again with java2ws and it
puts the complexTypes back into there correct namespace where they belong.

Janko

> 
> Thanks,
> Derek
> 
> 
> 
> ________________________________
> From: Derek Adams <[EMAIL PROTECTED]>
> To: [email protected]
> Sent: Sunday, December 7, 2008 4:03:54 PM
> Subject: Namespace problem in wsdl2java generated classes
> 
> I am having a problem with the WSDL generated from JAX-WS classes that were 
> originally created from the CXF wsdl2java tool. Basically, I have am writing 
> tool that allows you to import WSDL to generate JAX-WS interaces, then allows 
> you to fill in the implementations and deploy to a server. I am using CXF 
> embedded in Mule, but Mule just defers to the CXF QueryHandler to generate 
> the WSDL when requested over the endpoint. Here is the WSDL I am using for 
> testing:
> 
> <wsdl:definitionsxmlns="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:schemaxmlns="http://example.org/math/types/"targetNamespace="http://example.org/math/types/";><xs:complexTypename="MathInput"><xs:sequence><xs:elementname="x"type="xs:double"/><xs:elementname="z"type="xs:double"/></xs:sequence></xs:complexType><xs:complexTypename="MathOutput"><xs:sequence><xs:elementname="result"type="xs:double"/></xs:sequence></xs:complexType><xs:elementname="Add"type="type:MathInput"/><xs:elementname="AddResponse"type="type:MathOutput"/><xs:elementname="Subtract"ty
> pe="type:MathInput"/><xs:elementname="SubtractResponse"type="type:MathOutput"/></xs:schema></wsdl:types><wsdl:messagename="AddMessage"><wsdl:partname="parameters"element="type:Add"/></wsdl:message><wsdl:messagename="AddResponseMessage"><wsdl:partname="parameters"element="type:AddResponse"/></wsdl:message><wsdl:messagename="SubtractMessage"><wsdl:partname="parameters"element="type:Subtract"/></wsdl:message><wsdl:messagename="SubtractResponseMessage"><wsdl:partname="parameters"element="type:SubtractResponse"/></wsdl:message><wsdl:portTypename="MathInterface"><wsdl:operationname="Add"><wsdl:inputmessage="y:AddMessage"/><wsdl:outputmessage="y:AddResponseMessage"/></wsdl:operation><wsdl:operationname="Subtract"><wsdl:inputmessage="y:SubtractMessage"/><wsdl:outputmessage="y:SubtractResponseMessage"/></wsdl:operation></wsdl:portType><wsdl:bindingname="MathSoapHttpBinding"type="y:MathInterface"><soap:bindingstyle="document"transport="http://schemas.xmlsoap.org/
> soap/http"/><wsdl:operationname="Add"><soap:operationsoapAction="http://example.org/math/#Add"/><wsdl:input><soap:bodyuse="literal"/></wsdl:input><wsdl:output><soap:bodyuse="literal"/></wsdl:output></wsdl:operation><wsdl:operationname="Subtract"><soap:operationsoapAction="http://example.org/math/#Subtract"/><wsdl:input><soap:bodyuse="literal"/></wsdl:input><wsdl:output><soap:bodyuse="literal"/></wsdl:output></wsdl:operation></wsdl:binding><wsdl:servicename="MathService"><wsdl:portname="MathEndpoint"binding="y:MathSoapHttpBinding"><soap:addresslocation="http://localhost/math/math.asmx"/></wsdl:port></
>  
> Everything generates without problems, but there are errors when deployed in 
> Mule. CXF complains about bad namespaces on deployment indicating that the 
> namespaces for schema objects are incorrect: 
>  
>  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.
>  
> When I try to load the WSDL via http://endpoint?wsdl in a tool like SoapUI, I 
> get errors similar to the ones on deployment. After looking at the annotated 
> code generated from wsdl2java, I noticed that there is no namespace 
> declaration on the schema complex types. The elements have the correct 
> namespace, but they reference the complex types that have no namespace 
> declarations. Because of this, the generated WSDL splits the elements and 
> complex types into separate schema sections with different target namespaces. 
> I am honestly not sure if this is a CXF issue or a CXF-embedded-in-Mule 
> issue. Has anyone else run into this?
>  
> Thanks,
> Derek</wsdl:service>wsdl:definitions>
> 
> 
>       

Reply via email to