Problem using xsd:import in WSDL (JBoss 7.2.0 Alpha1)
timo.hirt Sep 5, 2012 9:42 AMCurrently I attempt to define some common types to be used in multiple WSLDs into a xsd file WorkPackageServiceTypes.xsd as follows:
<?xml version="1.0" encoding="UTF-8"?> <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.com/Common/WorkPackageServiceTypes" xmlns:tns="http://www.example.com/Common/WorkPackageServiceTypes" elementFormDefault="qualified"> <complexType name="WorkPackageType"> <sequence> <element name="Id" type="long" maxOccurs="1" minOccurs="1"> </element> <element name="StartDate" type="dateTime" maxOccurs="1" minOccurs="1"> </element> <element name="EndDate" type="dateTime" maxOccurs="1" minOccurs="1"></element> </sequence> </complexType> </schema>
I import this XSD into the WSDL of a service.
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.example.org/WorkPackageService/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="WorkPackageService" targetNamespace="http://www.example.org/WorkPackageService/"> <wsdl:types> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pref="http://www.example.com/Common/WorkPackageServiceTypes" targetNamespace="http://www.example.org/WorkPackageService/"> <xsd:import schemaLocation="WorkPackageServiceTypes.xsd" namespace="http://www.example.com/Common/WorkPackageServiceTypes"></xsd:import> .. </wsdl:types> </wsdl:definitions>
Both WSDL and XSD are located into the same folder (META-INF/wsdl/). wsconsume as well as the maven codegen plugin from the CXF project created all classes and stubs as expected. The web service is implemented as stateless session bean. If I deploy it to JBoss AS the following exception occurs during deployment.
15:38:03,890 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC00001: Failed to start service jboss.deployment.subunit."Demo Project-0.0.1.ear"."webservices-ejb-layer-0.0.1.jar".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.subunit."Demo Project-0.0.1.ear"."webservices-ejb-layer-0.0.1.jar".INSTALL: JBAS018733: Failed to process phase INSTALL of subdeployment "webservices-ejb-layer-0.0.1.jar" of deployment "Demo Project-0.0.1.ear" at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:123) [jboss-as-server-7.2.0.Alpha1-SNAPSHOT.jar:7.2.0.Alpha1-SNAPSHOT] at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA] at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA] at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) [rt.jar:1.6.0_27] at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.6.0_27] at java.lang.Thread.run(Unknown Source) [rt.jar:1.6.0_27] Caused by: java.lang.RuntimeException: Cannot publish wsdl to: D:\dev\jboss-as-7.2.0.Alpha1-SNAPSHOT\standalone\data\wsdl\Demo Project-0.0.1.ear\webservices-ejb-layer-0.0.1.jar\WorkPackageService.wsdl at org.jboss.wsf.stack.cxf.deployment.WSDLFilePublisher.publishWsdlFiles(WSDLFilePublisher.java:107) at org.jboss.wsf.stack.cxf.deployment.EndpointImpl.publishContractToFilesystem(EndpointImpl.java:133) at org.jboss.wsf.stack.cxf.deployment.EndpointImpl.doPublish(EndpointImpl.java:75) at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:246) at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:525) at org.jboss.wsf.stack.cxf.configuration.NonSpringBusHolder.configure(NonSpringBusHolder.java:119) at org.jboss.wsf.stack.cxf.deployment.aspect.BusDeploymentAspect.startDeploymentBus(BusDeploymentAspect.java:129) at org.jboss.wsf.stack.cxf.deployment.aspect.BusDeploymentAspect.start(BusDeploymentAspect.java:68) at org.jboss.as.webservices.deployers.AspectDeploymentProcessor.deploy(AspectDeploymentProcessor.java:74) at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:116) [jboss-as-server-7.2.0.Alpha1-SNAPSHOT.jar:7.2.0.Alpha1-SNAPSHOT] ... 5 more Caused by: java.io.IOException: JBAS015526: Child 'META-INF/wsdl/wsdl/Demo%20Project-0.0.1.ear/webservices-ejb-layer-0.0.1.jar/WorkPackageServiceTypes.xsd' not found for VirtualFile: "/D:/dev/jboss-as-7.2.0.Alpha1-SNAPSHOT/bin/content/Demo Project-0.0.1.ear/webservices-ejb-layer-0.0.1.jar" at org.jboss.as.webservices.util.VirtualFileAdaptor.findChild(VirtualFileAdaptor.java:62) at org.jboss.ws.common.deployment.ResourceResolverImpl.resolve(ResourceResolverImpl.java:79) at org.jboss.ws.common.utils.AbstractWSDLFilePublisher.publishSchemaImports(AbstractWSDLFilePublisher.java:223) at org.jboss.ws.common.utils.AbstractWSDLFilePublisher.publishSchemaImports(AbstractWSDLFilePublisher.java:249) at org.jboss.ws.common.utils.AbstractWSDLFilePublisher.publishSchemaImports(AbstractWSDLFilePublisher.java:249) at org.jboss.wsf.stack.cxf.deployment.WSDLFilePublisher.publishWsdlFiles(WSDLFilePublisher.java:94) ... 14 more
Is this a bug or am I doing anything wrong?