Webservice in JBoss doesn't find xsd
I try to implement a first Web service running in JBoss AS 7.2. I use the wsdlLocation-Property to link my service with a predefined wsdl file:
@Stateless
@WebServiceProvider(wsdlLocation = "classpath:wsdlprototype.wsdl")
public class MyServiceImpl implements MyPort {
@Override
public PingResponse ping(PingRequest request) {
//someCode
}
}
In my wsdl I include a xsd file stored in the same directory/classpath location:
<wsdl:types>
<xs:schema targetNamespace="http://prototype/type" elementFormDefault="qualified">
<xs:include schemaLocation="prototype.xsd"/>
</xs:schema>
</wsdl:types>
But it seems, that my jboss don't find this xsd file. Or better, he searches not at the right position. What I'm doing wrong?
Caused by: javax.wsdl.WSDLException: WSDLException (at /wsdl:definitions/wsdl:types/schema): faultCode=PARSER_ERROR: Problem parsing 'prototype.xsd'.: java.io.FileNotFoundException: C:toolsjbossbinprototype.xsd (The system cannot find the file specified)
at com.ibm.wsdl.xml.WSDLReaderImpl.getDocument(WSDLReaderImpl.java:2111)
at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(WSDLReaderImpl.java:808)
at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(WSDLReaderImpl.java:632)
at com.ibm.wsdl.xml.WSDLReaderImpl.parseTypes(WSDLReaderImpl.java:593)
at com.ibm.wsdl.xml.WSDLReaderImpl.parseDefinitions(WSDLReaderImpl.java:305)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(WSDLReaderImpl.java:2265)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(WSDLReaderImpl.java:2251)
at org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:261)
at org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.java:206)
at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:349)
... 13 more
Ah... I found the solution. The wsdl and xsd must be located in META-INF/wsdl or WEB-INF/wsdl. Another place in classpath seems not to be working.
I had the same issue where an xsd was not being found during deployment. This problem was intermittent - sometimes the deploy was fine. My service (wsdl) contract structure was like:
WEB-INF
wsdl
xsd
policy
I moved xsd and policy under wsdl and the intermittent problem is gone.
Thanks for taking the time to share your answer. It helped!
链接地址: http://www.djcxy.com/p/66664.html