未能创建服务无效wsdl,但它在测试中有效



环境:

  • 调试中的IntelliJ
  • JBoss 7.2
  • Java 11
  • jaxws 2.3.0

我在JUnit测试中创建了一个客户端,运行良好。当我尝试正常执行该方法时,问题就出现了。我收到错误"创建服务失败",原因是:javax.wsdl.WSDLException:WSDLException(位于/soapenv:Reason):faultCode=INVALID_wsdl:预期元素{http://schemas.xmlsoap.org/wsdl/}定义的

我使用";基本";服务URL。

我试着用";基本";服务URL+?wsdl在正常方法中,运行良好。为什么?

知道可能是什么吗?

错误

09:37:26,838 ERROR [es.caib.accfor.business.QueryService] (default task-4) Renova silcoiEmpleoClient: javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException: Failed to create service.
...
Caused by: org.apache.cxf.service.factory.ServiceConstructionException: Failed to create service.
at org.apache.cxf.impl//org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:87)
at org.apache.cxf.impl//org.apache.cxf.jaxws.ServiceImpl.initializePorts(ServiceImpl.java:218)
at org.apache.cxf.impl//org.apache.cxf.jaxws.ServiceImpl.initialize(ServiceImpl.java:161)
... 149 more
Caused by: javax.wsdl.WSDLException: WSDLException (at /soapenv:Reason): faultCode=INVALID_WSDL: Expected element '{http://schemas.xmlsoap.org/wsdl/}definitions'.
...

pom.xml

<dependencies>
<!-- Especificacions i llibreries proporcionades per JBoss -->
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-8.0</artifactId>
<type>pom</type>
<scope>provided</scope>
</dependency>
<!-- Anotacions de documentació de openapi -->
<dependency>
<groupId>org.eclipse.microprofile.openapi</groupId>
<artifactId>microprofile-openapi-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-core</artifactId>
<scope>provided</scope>
</dependency>
<!-- Altres mòduls del projecte -->
<dependency>
<groupId>es.caib.accfor</groupId>
<artifactId>accfor-commons</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>es.caib.accfor</groupId>
<artifactId>accfor-persistence</artifactId>
<scope>provided</scope>
</dependency>
<!-- Altres llibreries necessàries per aquest mòdul -->
<!-- Només necessària per la generació de codi -->
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
<version>0.9.11</version>
<exclusions>
<exclusion>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
</exclusion>
</exclusions>
</dependency>
<!--Dependencies per ws silcoi-->
<!-- JAXWS for Java 11 -->
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.3.0</version>
</dependency>
<!-- Dependències de test -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<!--<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-runner</artifactId>
<scope>test</scope>
</dependency>-->
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<scope>test</scope>
</dependency>
<!--<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>-->
<!-- Per tests amb Arquillian -->
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-nop</artifactId>
<scope>test</scope>
</dependency>
<!--<dependency>
<groupId>pl.pragmatists</groupId>
<artifactId>JUnitParams</artifactId>
<scope>test</scope>
</dependency>-->
<!-- Per fer tests d'integració amb base de dades en memòria -->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc10</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

由以下原因引起:javax.wsdl.WSDLException:WSDLException(位于/soapenv:Reason):faultCode=INVALID_wsdl:预期元素'{http://schemas.xmlsoap.org/wsdl/}定义'

它似乎没有识别出根元素:<wsdl:definitions>。检查wsdl是否正确。

相关内容

  • 没有找到相关文章

最新更新