'Failed to create service Invalid wsdl but it works in the test
Environment:
- IntelliJ in debug
- JBoss 7.2
- Java 11
- jaxws 2.3.0
I have created a client in a JUnit test and work well. The problem comes when I try to execute the method normally. I get the error 'Failed to create service' Caused by: javax.wsdl.WSDLException: WSDLException (at /soapenv:Reason): faultCode=INVALID_WSDL: Expected element '{http://schemas.xmlsoap.org/wsdl/}definitions'
I use the "base" service URL.
I've tried to use "base" service URL + ?wsdl in normal method and works well. Why is that?
Any idea what could it be?
Error
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>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|