我尝试实现在JBoss AS 7.2中运行的第一个Web服务。我使用wsdlLocation-Property将我的服务与预定义的wsdl文件链接:
@Stateless
@WebServiceProvider(wsdlLocation = "classpath:wsdl\\prototype.wsdl")
public class MyServiceImpl implements MyPort {
@Override
public PingResponse ping(PingRequest request) {
//someCode
}
}
在我的wsdl中,我包含了一个存储在同一目录/类路径位置的xsd文件:
<wsdl:types>
<xs:schema targetNamespace="http://prototype/type" elementFormDefault="qualified">
<xs:include schemaLocation="prototype.xsd"/>
</xs:schema>
</wsdl:types>
但似乎我的jboss找不到这个xsd文件。或者更好的是,他不是在正确的位置搜索。我做错了什么?
Caused by: javax.wsdl.WSDLException: WSDLException (at /wsdl:definitions/wsdl:types/schema): faultCode=PARSER_ERROR: Problem parsing 'prototype.xsd'.: java.io.FileNotFoundException: C:\tools\jboss\bin\prototype.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
答案 0 :(得分:0)
答案 1 :(得分:0)
我遇到了在部署期间未找到xsd的问题。这个问题是间歇性的 - 有时部署很好。我的服务(wsdl)合同结构如下:
WEB-INF
wsdl
xsd
policy
我在wsdl下移动了xsd和策略,间歇性问题消失了。
感谢您抽出宝贵时间分享您的答案。它有所帮助!