Custom package in wsdl2java (CXF)

cxf

Solution

You should use lots of -p options. Like this:

wsdl2java -db xmlbeans -d "D:\MY_PROJECT" \
-p http://services.test.co.uk/service/banking/walletTransaction/TransferFunds/1.0=com.greeting.services \
-p http://cdm.test.co.uk/common/Country/2.0=com.greeting.cdm \
-p http://cdm.test.co.uk/customer/Customer/2.0=com.greeting.cdm \
... \
wsdllocation

Problem

I want to generate custom package using wsdl2java(CXF) command. My WSDL structure is: ``` wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:jms="http://www.tibco.com/namespaces/ws/2004/soap/binding/JMS" xmlns:ns20="http://cdm.test.co.uk/marketing/Promotions/2.0" xmlns:jndi="http://www.tibco.com/namespaces/ws/2004/soap/apis/jndi" xmlns:ns16="http://cdm.test.co.uk/common/CrossRef/2.0" xmlns:ns17="http://services.test.co.uk/service/CommonMessage/2.0" xmlns:ns14="http://cdm.test.co.uk/banking/Wallet/2.0" xmlns:ns15="http://cdm.test.co.uk/common/Currency/2.0" xmlns:ns18="http://cdm.test.co.uk/customer/Transaction/2.0" xmlns:ns19="http://cdm.test.co.uk/party/PartyRole/2.0" xmlns:ns9="http://cdm.test.co.uk/common/Channel/2.0" xmlns:soap1="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:ns12="http://cdm.test.co.uk/banking/Payment/2.0" xmlns:ns5="http://cdm.test.co.uk/common/InternationalMoney/2.0" xmlns:ns13="http://cdm.test.co.uk/customer/Account/2.0" xmlns:ns6="http://cdm.test.co.uk/common/Location/2.0" xmlns:ns10="http://cdm.test.co.uk/retail/RetailShop/2.0" xmlns:ns7="http://cdm.test.co.uk/party/Party/2.0" xmlns:ns11="http://cdm.test.co.uk/common/BaseType/2.0" xmlns:ns8="http://cdm.test.co.uk/product/Games/2.0" xmlns:ns2="http://cdm.test.co.uk/common/Country/2.0" xmlns:ns1="http://cdm.test.co.uk/customer/Customer/2.0" xmlns:ns4="http://cdm.test.co.uk/partner/Affiliate/2.0" xmlns:ns3="http:///common/ManagedEntity/2.0" xmlns:tns="http://services.test.co.uk/service/banking/walletTransaction/TransferFunds/1.0" xmlns:ns0="http://cdm.test.co.uk/producdm.test.co.ukct/Catalogue/2.0" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" targetNamespace="http://services.test.co.uk/service/banking/walletTransaction/TransferFunds/1.0" ``` I am using below command to generate the java files: wsdl2java -db xmlbeans -d "D:\MY_PROJECT" wsdllocation So all the java files are created in uk.co.test.cdm and uk.co.test.services folder. But I want to generate all files under com.greeting.cdm and com.greeting.services folder. means uk.co.test should be replaced by com.greeting. I have used this option in the command to change the package: -p com.greeting but this is not working. Can anyone please give the solution to fix this problem.

Original source