Auto generate Java Code from WSDL using Axis

Thread Solved

Join Date: Sep 2006
Posts: 10
Reputation: thiyagu_mca2006 is an unknown quantity at this point 
Solved Threads: 0
thiyagu_mca2006 thiyagu_mca2006 is offline Offline
Newbie Poster

Auto generate Java Code from WSDL using Axis

 
0
  #1
Jul 23rd, 2007
Hi All,

Im Thiyagu, a junior software developer(Java/J2ee). I have assigned to access Webservice (sending request and receiving response from a WSDL). can any tell me the steps involved to convert Java code from a WSDL file using Axis(with ant build script).
please very urgent.

Note : I already tried with Aixs and generated Java code from WSDL , but I got some error while sending request, i.e

Exception in thread "main" AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server
faultSubcode:
faultString: Server was unable to process request. ---> Object reference not set to an instance of an object.
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace: AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server
faultSubcode:
faultString: Server was unable to process request. ---> Object reference not set to an instance of an object.
faultActor:
faultNode:
faultDetail:
Server was unable to process request. ---> Object reference not set to an instance of an object.


Thank,
Thiyagu.
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 31
Reputation: ksaxena is an unknown quantity at this point 
Solved Threads: 4
ksaxena ksaxena is offline Offline
Light Poster

Re: Auto generate Java Code from WSDL using Axis

 
0
  #2
Jul 23rd, 2007
Two things you need to define in your ant properties or build.xml file:
1. Define typeDef for your WSDL to Java utility so as to use in ant target
  1. <typedef name="wsdl2java" classname="org.apache.axis.tools.ant.wsdl.Wsdl2javaAntTask" classpathref="axisclasspath"/>
2. Within your desired target say
  1. <wsdl2java verbose="true" output="${yourOutputDir}/wsdl" url="${wsdlFileName}.wsdl" deployScope="Session">
  2. <mapping package="${package}" namespace="urn:${service.name}"/>
  3. </wsdl2java>

Make sure you have mentioned axisclasspath using <path id="axisclasspath">....</path>, which is required by step 1, this is the classpath which ant will internally use to compile WSDL to generate stubs and impl files, so make sure you have mentioned all necessary Axis jars in it.

Hope this will help.
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,143
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 213
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: Auto generate Java Code from WSDL using Axis

 
0
  #3
Jul 24th, 2007
no, it is NOT urgent.

The thing to do is to read the documentation, which explains it all in detail.
The steps for using ANT to retrieve the WSDL and generate your classes has already been outlined above though not every option you could use mentioned, use the manual to find out about those.
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 10
Reputation: thiyagu_mca2006 is an unknown quantity at this point 
Solved Threads: 0
thiyagu_mca2006 thiyagu_mca2006 is offline Offline
Newbie Poster

Re: Auto generate Java Code from WSDL using Axis

 
0
  #4
Jul 25th, 2007
Originally Posted by ksaxena View Post
Two things you need to define in your ant properties or build.xml file:
1. Define typeDef for your WSDL to Java utility so as to use in ant target
  1. <typedef name="wsdl2java" classname="org.apache.axis.tools.ant.wsdl.Wsdl2javaAntTask" classpathref="axisclasspath"/>
2. Within your desired target say
  1. <wsdl2java verbose="true" output="${yourOutputDir}/wsdl" url="${wsdlFileName}.wsdl" deployScope="Session">
  2. <mapping package="${package}" namespace="urn:${service.name}"/>
  3. </wsdl2java>

Make sure you have mentioned axisclasspath using <path id="axisclasspath">....</path>, which is required by step 1, this is the classpath which ant will internally use to compile WSDL to generate stubs and impl files, so make sure you have mentioned all necessary Axis jars in it.

Hope this will help.

Dear ksaxena,

Thank you very much for your kind information. The problem I faced was, the Webservice need the Client to send SOAPHeader along with request. I tried it to set SOAPHeaderElement before I invoking service using setHeader(SOAPHeaderElemet). Its working fine now , and I can send and receive response well.

Thanks,
Thiyagu.
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 10
Reputation: thiyagu_mca2006 is an unknown quantity at this point 
Solved Threads: 0
thiyagu_mca2006 thiyagu_mca2006 is offline Offline
Newbie Poster

Re: Auto generate Java Code from WSDL using Axis

 
0
  #5
Jul 25th, 2007
Originally Posted by jwenting View Post
no, it is NOT urgent.

The thing to do is to read the documentation, which explains it all in detail.
The steps for using ANT to retrieve the WSDL and generate your classes has already been outlined above though not every option you could use mentioned, use the manual to find out about those.
Dear jwenting,

Thank you very much for your kind information. The problem I faced was, the Webservice need the Client to send SOAPHeader along with request. I tried it to set SOAPHeaderElement before I invoking service using setHeader(SOAPHeaderElemet). Its working fine now , and I can send and receive response well.

Thanks,
Thiyagu.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC