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>
