Hi all, I am very new to the webservices technology so please bear with me and help me out if you can. There is a webservices (not developed by me) which is deployed on websphere server and I have been given a wsdl file. Now I want to call this webservice from my jsp file which is deployed on a differen server. Can this be done. I have heard there is a tool called wsdl2java which converts the wsdl file to java files and we just have to import those java files and call the functions as we normally do. Is that all that is required from me? Do I need to install axis or anyother such thing to be able to use wsdl2java? Morover from where do I download this tool? Would appreciate if someone replies or point me over to some links..
Originally posted by Alex Luc: Do I need to install axis or anyother such thing to be able to use wsdl2java?
If you choose to use Axis as your SOAP stack then installing Axis is the easiest way to go. However you only need to deploy the generated client stubs and any axis jars that those stubs reference to the actual client. Many of the more recent platform IDEs will give you similar functionality without having to introduce Axis. You haven't mentioned whether you intend to use Axis 1.x or Axis 2 (which requires Java 1.5). For Axis 1.x Creating Web Services with Apache Axis will give you an idea what you need to do to create the client stubs.
Moreover from where do I download this tool?
For Axis it is part of the normal distribution. It's the org.apache.axis.wsdl.WSDL2Java class (Axis 2 has a wsdl2java.bat/sh script in the bin directory).
Thanks, that helps me a lot. I was not able to download axis 1.2 because all links here were dead, so downloaded axis 1.4 Tried to run wsdl2java but got this error: Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/axis/wsdl/WSDL2Java I ran this from the directory in which axis.jar is located... Should the server be started when I run this? [ August 06, 2007: Message edited by: ubz tayb ]
Thanks Peter for that, now I am able to create the java files from the wsdl file after adding the axis and other related jar files in the classpath. One thing I didnt understood was if .(dot..current directory) is in my classpath and I execute WSDL2Java from the folder in which the jar files are located, then I SHOULD be able to run it but it always gave me Class not found error..this is something which i find very strange. Also..It has created a lot of files. Two interfaces WSName, WSNameService and 2 classes WSNameSeviceLocator WSNameSoapBindingStub. Now which files do I include and what functions do I call I from my jsp? [ August 16, 2007: Message edited by: Alex Luc ]
Originally posted by Alex Luc: One thing I didnt understood was if .(dot..current directory) is in my classpath and I execute WSDL2Java from the folder in which the jar files are located, then I SHOULD be able to run
Incorrect. Including the current directory in your class path allows you to "pick up" *.class files in the current directory, not *.jar files (they have to be mentioned explicitly). Also with Axis there is the matter of the AXIS_HOME and AXISCLASSPATH environment variables that have to be set properly.
Now which files do I include and what functions do I call I from my jsp?