I am trying to deploy a basic web service, my wsdl is located as shown in the following beans.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml" />
<jaxws:endpoint
id="helloWorld"
implementor="com.tsdevelopment.HelloWorldImpl"
wsdlLocation="src/main/resources/wsdl/HelloWorld.wsdl"
address="/HelloWorld" />
</beans>
When i deploy with mvn wildfly:deploy i get the following error:
Caused by: java.io.FileNotFoundException: C:\Users\codereadystudio\jboss-eap-7.3\bin\src\main\resources\wsdl\HelloWorld.wsdl (The system cannot find the path specified)
at java.base/java.io.FileInputStream.open0(Native Method)
at java.base/java.io.FileInputStream.open(FileInputStream.java:211)
at java.base/java.io.FileInputStream.<init>(FileInputStream.java:153)
at java.base/java.io.FileInputStream.<init>(FileInputStream.java:108)
at java.base/sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:86)
at java.base/sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:189)
at org.apache.xerces@2.12.0.SP02-redhat-00001//org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:1009)
at org.apache.xerces@2.12.0.SP02-redhat-00001//org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:144)
at org.apache.xerces@2.12.0.SP02-redhat-00001//org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:832)
at org.apache.xerces@2.12.0.SP02-redhat-00001//org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:798)
at org.apache.xerces@2.12.0.SP02-redhat-00001//org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:108)
at org.apache.xerces@2.12.0.SP02-redhat-00001//org.apache.xerces.parsers.DOMParser.parse(DOMParser.java:230)
at org.apache.xerces@2.12.0.SP02-redhat-00001//org.apache.xerces.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:298)
at deployment.soap-cxf-wsdlfirst-jbosseap73-1.0-SNAPSHOT.war//com.ibm.wsdl.xml.WSDLReaderImpl.getDocument(WSDLReaderImpl.java:2188)
... 56 more
Why is it searching for the WSDL in the jboss installation folder and not in the code?
CodePudding user response:
It seems the reason that it was unable to find the WSDL was that while in pom.xml the wsdl paths were as following:
<wsdlOptions>
<wsdlOption>
<wsdl>
src/main/resources/wsdl/HelloWorld.wsdl
</wsdl>
<wsdlLocation>wsdl/HelloWorld.wsdl</wsdlLocation>
</wsdlOption>
</wsdlOptions>
The java class that the cxf cxf-codegen-plugin generated did not include the wsdlLocation parameter in the @WebService annotation. Also please note that the parameter path must contain only the folders under your build path. That said, while my pom.xml location was /src/main/resources/wsdl/HelloWorld.wsdl, my parameter was wsdl/HelloWorld.wsdl, because i had already included the /src/main/resources folder on the build path.