How to specify multiple WSDLs for generating JAX-WS artifacts using CXF’s Maven plugin for wsdl2java (cxf-codegen-plugin)?


<plugin>
	<groupId>org.apache.cxf</groupId>
	<artifactId>cxf-codegen-plugin</artifactId>
	<version>${cxf.version}</version>
	<executions>
		<execution>
			<id>generate-sources</id>
			<phase>generate-sources</phase>
			<configuration>
				<sourceRoot>${project.build.directory}/generated/cxf</sourceRoot>
				<wsdlOptions>
					<!-- for myService1.wsdl -->
					<wsdlOption>
						<wsdl>${basedir}/src/main/wsdl/myService1.wsdl</wsdl>
					</wsdlOption>
					<!-- for myService2.wsdl -->
					<wsdlOption>
						<wsdl>${basedir}/src/main/wsdl/myService2.wsdl</wsdl>
					</wsdlOption>
					. . .
				</wsdlOptions>
			</configuration>
			<goals>
				<goal>wsdl2java</goal>
			</goals>
		</execution>
	</executions>
</plugin>

Each element corresponds to a WSDL for which we need to generate artifcats.

About these ads

3 comments

  1. Mina Daoud · · Reply

    Thanks for the nice post! I actually was wondering if i can specify a WSDL’s url, or the WSDL should be stored locally?

    1. Mina Daoud · · Reply

      It is so helpful! i wanted to ask how to specify a WSDL url instead of loca WSDL. eg. http://localhost:8080/……

      Thanks,

      1. Mina,

        You can specify either a locally saved WSDL or the one which is exposed online (via internet/intranet).

        For example, if you’re writing a client for Amazon Web Services to dynamically make calls to the Amazon database (its catalog), extract information about its complete product line, and purchase products, you can specify the WSDL URL like this – http://soap.amazon.com/schemas2/AmazonWebServices.wsdl – between wsdl xml element.

        It gets a bit tricky if you have an online URL to refer to and it’s SSL enabled like the one PayPal has – https://www.paypal.com/wsdl/PayPalSvc.wsdl. In those scenarios, I usually download the required WSDLs, and related XSDs, and keep it locally.

        ~Sing.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 26 other followers

%d bloggers like this: