GeeCON Prague 2014*
The moose likes Websphere and the fly likes Java2WSDL command inside WebSphere how to use it! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Products » Websphere
Bookmark "Java2WSDL command inside WebSphere how to use it!" Watch "Java2WSDL command inside WebSphere how to use it!" New topic
Author

Java2WSDL command inside WebSphere how to use it!

hani Ibrahim
Ranch Hand

Joined: Sep 06, 2006
Posts: 182
Dear All,
still struggling with the my first steps to deploy Web Service...i know you here to give us some aid..please dont hesitate..
i tried to use Java2WSDL command in this format
for example if i have Hello.class interface in the same directory of Java2WSDL- that contains one method that return "Hi EveryBody" -and i want to generate a WSDL file.
if i write
Java2WSDL Hi
Or:
Java2WSDL Hi.class
-------------------------------------------------------------------------------
i have this Excption:
java.io.IOException: java.lang.ClassNotFoundException: Hi
at com.ibm.ws.webservices.wsdl.fromJava.Emitter.init(Emitter.java:794)
at com.ibm.ws.webservices.wsdl.fromJava.Emitter.getWSDL(Emitter.java:659
)
at com.ibm.ws.webservices.wsdl.fromJava.Emitter.emit(Emitter.java:589)
at com.ibm.ws.webservices.wsdl.fromJava.Emitter.preEmit(Emitter.java:482
)
at com.ibm.ws.webservices.wsdl.fromJava.Emitter.emit(Emitter.java:524)
at com.ibm.ws.webservices.wsdl.fromJava.Emitter.emit(Emitter.java:563)
at com.ibm.ws.webservices.tools.Java2WSDL.run(Java2WSDL.java:607)
at com.ibm.ws.webservices.tools.Java2WSDL.main(Java2WSDL.java:653)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:64)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:615)
at com.ibm.ws.bootstrap.WSLauncher.main(WSLauncher.java:263)

-------------------------------------------------------------------------------
Any kindly Help Please or at least give me link or example of using this command witohut IDE like Rational for generate appropriate WSDL file .
thanks a lot for everyone help or try to help either.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

I don't know much about web services. But the relevant error message is this one:
So did you mean to use a class named "Hi"? If so, then it should be in your classpath. And most likely it should be in a package too, but I don't know that for certain. But if you didn't expect to be using the "Hi" class, then there's something wrong with your web service.
[ November 15, 2006: Message edited by: Paul Clapham ]
Tim LeMaster
Ranch Hand

Joined: Aug 31, 2006
Posts: 226
You mention Hello.class in your text but list Hi.class in your commandline example. Which is it?

Why is Hi.class in the same directory as Java2WSDL? It should be in a package or in a package in a jar. And that directory or jar should be on the classpath.

/home/timle/bin/net/thelemasters/hi/Hi.class

In this example /home/timle/bin should be on the classpath. And you should invoke

Java2WSDL net.thelemasters.hi.Hi
digvijay rai
Greenhorn

Joined: Sep 28, 2006
Posts: 8
Hi Hani,
Java2WSDL: Building WSDL from Java
The Java2WSDL and WSDL2Java emitters make it easy to develop a new web service. The following sections describe the steps in building a web service from a Java interface.

Step 1: Provide a Java interface or class
Write and compile a Java interface (or class) that describes the web service interface. Here is an example interface that describes a web services that can be used to set/query the price of widgets (samples/userguide/example6/WidgetPrice.java):

package samples.userguide.example6;

/**
* Interface describing a web service to set and get Widget prices.
**/
public interface WidgetPrice {
public void setWidgetPrice(String widgetName, String price);
public String getWidgetPrice(String widgetName);
}Note: If you compile your class with debug information, Java2WSDL will use the debug information to obtain the method parameter names.

Step 2: Create WSDL using Java2WSDL
Use the Java2WSDL tool to create a WSDL file from the interface above.

Here is an example invocation that produces the wsdl file (wp.wsdl) from the interface described in the previous section:

% java org.apache.axis.wsdl.Java2WSDL -o wp.wsdl
-l"http://localhost:8080/axis/services/WidgetPrice"
-n "urn:Example6" -p"samples.userguide.example6" "urn:Example6"
samples.userguide.example6.WidgetPriceWhere:

-o indicates the name of the output WSDL file
-l indicates thelocation of the service
-n is the target namespace of the WSDL file
-p indicates a mapping from the package to a namespace. There may be multiple mappings.
the class specified contains the interface of the webservice.
The output WSDL document will contain the appropriate WSDL types, messages, portType, bindings and service descriptions to support a SOAP rpc, encoding web service. If your specified interface methods reference other classes, the Java2WSDL tool will generate the appropriate xml types to represent the classes and any nested/inherited types. The tool supports JAX-RPC complex types (bean classes), extension classes, enumeration classes, arrays and Holder classes.

The Java2WSDL tool has many additional options which are detailed in the reference guide. There is an Ant Task to integrate this action with an Ant based build process.

you can refer to axis user guide.
sal sathya
Greenhorn

Joined: Jul 28, 2010
Posts: 11


and i use the axis2-1.5.1 is in my D:\
so how the java2wsdl file creation has to done
by your reply that part i had done like this


D:\axis2-1.5.1>java org.apache.axis.wsdl.Java2WSDL -o wp.wsdl -l"http://localhos
t:8080/axis/services/WidgetPrice" -n "urn:Example6" -p"samples.userguide.example
6" "urn:Example6" com.salish.Webserver
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/axis/wsdl/
Java2WSDL
Caused by: java.lang.ClassNotFoundException: org.apache.axis.wsdl.Java2WSDL
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
what is the problem

mycomputer>>>properties>>> Environmental Variable
AXIS2_HOME====D:\axis2-1.5.1
JAVA_HOME=====C:\Program Files\Java\jdk1.6.0

what is the problem what i has to do

what are steps need for me to start a webservices program .what is the axis,what is cxf ,what is REStful webservices, where i has to put the files to work as a web services
I'm using eclipse in that the webservices project is making as a simple as but i want to do ti with the notepad free from IDE so from where i has to strart

sorry for these foolish question
but please help me
thanks in advance




 
GeeCON Prague 2014
 
subject: Java2WSDL command inside WebSphere how to use it!