How to create and include Java classes and multiple WSDLs for a jar
Asked Answered
W

2

7

I'm generating java classes from multiple wsdl files. Works. However, I want to provide the appropriate wsdl file in the @WebServiceClient annotation. In the attribute wsdlLocation I expect the directory path concatenated with the distinct file name. E.g. /myDir/myWsdl-1.wsdl for the first webservice. However, the wsdlLocation is populated with "/myDir" only - without the service name. How do I supply that name for each wsdl?

@WebServiceClient(name = "myService", targetNamespace = "http://mycompany.com/services/", wsdlLocation = "/myDir")

Below is my instruction:

<wsdlLocation>/myDir</wsdlLocation>
<wsdlDirectory>src/main/resources/myDir</wsdlDirectory>
<wsdlFiles>
    <wsdlFile>myWsdl-1.wsdl</wsdlFile>
    <wsdlFile>myWsdl-2.wsdl</wsdlFile>
    <wsdlFile>myWsdl-3.wsdl</wsdlFile>
    <wsdlFile>myWsdl-4.wsdl</wsdlFile>
</wsdlFiles>

What slips my attention?

Thanks for any hints. Feder.

Wayfaring answered 25/6, 2013 at 9:51 Comment(1)
Adding /* to the wsdLocation value doesn't help neither. It reports External binding file(s) can not be bound to more WSDL files (/myDir/*)Please use either inline binding(s) or multiple execution tags.Wayfaring
W
8

Ok. One may use the path followed by a slash and an asterisk in order to generate classes for mutlitple WSDL files. E.g.

<wsdlLocation>/myDir/*</wsdlLocation>

However, in this case, you cannot apply a binding.

<bindingDirectory>src/main/binding</bindingDirectory>

If you need to apply a binding for each of the WSDLs, then you must repeat the execution block of the plugin or apply a wsdl-inline-binding. See this discussion for inline-binding.

Hope this helps others, too.

Wayfaring answered 25/6, 2013 at 11:52 Comment(0)
T
0

I think you are missing <wsdlFiles> element enclosing list of <wsdlFile> elements. It should be like this:

<wsdlDirectory>src/main/resources/myDir</wsdlDirectory>
<wsdlFiles>
    <wsdlFile>myWsdl-1.wsdl</wsdlFile>
    <wsdlFile>myWsdl-2.wsdl</wsdlFile>
    <wsdlFile>myWsdl-3.wsdl</wsdlFile>
    <wsdlFile>myWsdl-4.wsdl</wsdlFile>
</wsdlFiles>
Thalamencephalon answered 25/6, 2013 at 12:24 Comment(1)
Example how to use <wsdlLocation> can be found here: jax-ws-commons.java.net/jaxws-maven-plugin/…Thalamencephalon

© 2022 - 2024 — McMap. All rights reserved.