Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

maven

wsimport

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.

like image 812
feder Avatar asked Jun 25 '13 09:06

feder


1 Answers

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.

like image 147
feder Avatar answered Nov 14 '22 18:11

feder