Relative path for WSDL in CXF Webservice Client

In my application, I use many web services. Since WSDL does not change, I have included WSDL files in my project. If I use the WSDL2Java Tool from CXF, the absolute path of the WSDL locations is hard-coded.

Now my question is: how to change the "wsdlocation" parameter in the @WebserviceClient annotation to a relative path?

Here is an example:

@WebServiceClient(name = "Time", wsdlLocation = "file:/C:/Users/dominik/Documents/NetBeansProjects/Webservices/src/wsdl/Time.wsdl" ) /*I want this path to be relative */ public class Time extends Service { 
+4
source share
3 answers

I finally figured out how to do it today. Just put the files in your resources folder, and then you can use wsdlLocation to reference them relatively as follows:

 <wsdlLocation>classpath:wsdl/myservice.wsdl</wsdlLocation> 

See my answer to a similar question: fooobar.com/questions/45432 / ...

+11
source

Here's what you can do to create an empty wsdl location

 <wsdlOptions> <wsdlOption> <wsdl>${basedir}/src/main/wsdl/service.wsdl</wsdl> <extraargs> <extraarg>-wsdlLocation</extraarg> <wsdlurl /> </extraargs> </wsdlOption> </wsdlOptions> 

The client can then take the wsdl location as an argument and become a portable client. That's why I was looking for a relative path: reached a portable client

+1
source

The wsdl2java tool has the -wsdlLocation flag, which can be used to indicate the exact line that is placed there.

0
source

All Articles