Reputation: 121
I am a new bie to the world of webservices , I have to develop the client side code that is the java code,I have been provided a wsdl which I can see by opening that wsdl in the browser , As i have access to wsdl please let me know how can I generate the client side code from that wsdl itself through Axis 2, any help will be appreciated, Thanks in advance
Upvotes: 2
Views: 1350
Reputation: 259
There are many ways to generate client and server stubs. you can use WSDL2Code Plug-in approach This plugin takes as input a WSDL and generates client and server stubs for calling or implementing a Web service matching the WSDL. add the following section to your POM
<plugin>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-wsdl2code-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<id>ws1</id>
<goals>
<goal>wsdl2code</goal>
</goals>
<configuration>
<unpackClasses>true</unpackClasses>
<databindingName>adb</databindingName>
<packageName>ma.glasnost.sample.axis2-maven</packageName>
<wsdlFile>src/main/resources/ws.wsdl</wsdlFile>
<outputDirectory>target/generated-sources</outputDirectory>
<syncMode>sync</syncMode>
</configuration>
</execution>
..... if you have many web services
</executions>
</plugin>
Also add axis2 jars as a dependency
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2</artifactId>
<version>1.4</version>
</dependency>
Upvotes: 1
Reputation: 3794
If you are using Eclipse then use Java code generation as mentioned in this link.http://axis.apache.org/axis2/java/core/tools/eclipse/wsdl2java-plugin.html#WSDL2Java
Upvotes: 0
Reputation: 4776
Here a brief overview what you will have to do to generate the client-side java code:
So your command will look something like below:
java -classpath axis.jar;%CATALINA_HOME%/shared/lib/commons-httpclient.jar;%CATALINA_HOME%/shared/lib/log4j.jar;%CATALINA_HOME%/shared/lib/commons-logging.jar;wsdl4j.jar;commons-net.jar;commons-discovery.jar;jaxrpc.jar;soap.jar;saaj.jar org.apache.axis.wsdl.WSDL2Java your_wsdl_fileName.wsdl
Upvotes: 0