| | |
Auto generate Java Code from WSDL using Axis
Thread Solved |
•
•
Join Date: Sep 2006
Posts: 10
Reputation:
Solved Threads: 0
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.
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.
•
•
Join Date: Jul 2007
Posts: 31
Reputation:
Solved Threads: 4
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 2. Within your desired target say
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.
1. Define typeDef for your WSDL to Java utility so as to use in ant target
Java Syntax (Toggle Plain Text)
<typedef name="wsdl2java" classname="org.apache.axis.tools.ant.wsdl.Wsdl2javaAntTask" classpathref="axisclasspath"/>
Java Syntax (Toggle Plain Text)
<wsdl2java verbose="true" output="${yourOutputDir}/wsdl" url="${wsdlFileName}.wsdl" deployScope="Session"> <mapping package="${package}" namespace="urn:${service.name}"/> </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.
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.
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.
•
•
Join Date: Sep 2006
Posts: 10
Reputation:
Solved Threads: 0
•
•
•
•
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 target2. Within your desired target sayJava Syntax (Toggle Plain Text)
<typedef name="wsdl2java" classname="org.apache.axis.tools.ant.wsdl.Wsdl2javaAntTask" classpathref="axisclasspath"/>Java Syntax (Toggle Plain Text)
<wsdl2java verbose="true" output="${yourOutputDir}/wsdl" url="${wsdlFileName}.wsdl" deployScope="Session"> <mapping package="${package}" namespace="urn:${service.name}"/> </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.
•
•
Join Date: Sep 2006
Posts: 10
Reputation:
Solved Threads: 0
•
•
•
•
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.
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.
![]() |
Similar Threads
- Move out java code from jsp (Java)
- Help with Java code (Java)
- Can N E 1 Help!!!! -- Need sample Java code (Java)
- java code newbie (Java)
Other Threads in the Java Forum
- Previous Thread: Reversing the elements of an array
- Next Thread: How to download a file
| Thread Tools | Search this Thread |
actuate add android api applet application applications array arrays automation balls bank binary bluetooth business chat class clear client code codesnippet collections component database defaultmethod development dice digit dragging ebook eclipse equation error event formatingtextintooltipjava fractal functiontesting game givemetehcodez graphics gui health hql html hyper ide idea image infinite int integer invokingapacheantprogrammatically j2me java javame javaprojects jni jpanel julia linux list main map method methods mobile myregfun mysql netbeans nonstatic openjavafx parameter pearl php problem program project recursion repositories scanner scrollbar server set sms sort sorting spamblocker sql sqlserver state storm string sun superclass swing swt thread threads tree windows






