I have wsdl file in Eclipse and I am generating the client via axis2 plugin.
The files are being generated to a package called com.mycompany.stub in source folder.
I would like to change the package names of the generated source files to com.mycompany.ws.workflow
Where can I do it in the wsdl file?
You don't really have to modify wsdl to achieve this. If you are using Eclipse Helios Web service Client Wizard, On the second step (optional) where you specify output folder for generated source, there's a checkbox for 'Define custom mapping for namespace to package.'. Select that box and on the next form you can define your custom package mappings.
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="http://mycompany.com/MyService.wsdl"
xmlns:scm="http://mycompany.com/MyService.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
targetNamespace="http://mycompany.com/MyService.wsdl">
...
For simple wsdl as shown above, custom mapping would look like as below.
http://mycompany.com/MyService.wsdl - com.mycompany.ws.workflow
http://mycompany.com/MyService.xsd - com.mycompany.ws.workflow.schema
You can click Add and enter name-space and package names or you can store mapping in properties file and click import to add it all at once. I prefer properties file. Also you have to escape the name space URL and other special characters if you are going to use properties file. Your properties file should look similar to below.
http\://mycompany.com/MyService.wsdl=com.mycompany.ws.workflow
http\://mycompany.com/MyService.xsd=com.mycompany.ws.workflow.schema
Excerpt from official documentation.
The content of the properties file must be of the format namespace=package. You will need to escape some special characters in the properties files. For example http://someNamespace=somePackage should be http://someNamespace=somePackage. Otherwise, the colon (:) would be treated as delimiter resulting in trying to map http to //someNamespace=somePackage.
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