In my Application I use many Webservices. As the WSDL does not change, I have integrated the WSDL files in my project. If I use the WSDL2Java Tool from CXF, the WSDL locations absolute path is hardcoded.
Now my Question is, how to change the "wsdlocation" parameter in the @WebserviceClient Annotation to a relative path?
Here is a 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 {
I finally figured out how to do this correctly today. Just put the files is your resources folder and then you can use wsdlLocation to refer to them relatively like this:
<wsdlLocation>classpath:wsdl/myservice.wsdl</wsdlLocation>
See my answer to a similar question here: https://stackoverflow.com/a/9875701/1190144
Here is what one can do for generating an empty wsdl location
<wsdlOptions>
<wsdlOption>
<wsdl>${basedir}/src/main/wsdl/service.wsdl</wsdl>
<extraargs>
<extraarg>-wsdlLocation</extraarg>
<wsdlurl />
</extraargs>
</wsdlOption>
</wsdlOptions>
The client then can receive the wsdl location as an argument and become an portable client. That's why I was looking for use an relative path: achieve an portable client
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With