ONce the applicaiton and project is create select the project and create a simple Java class file
Provide some logical name to your java class
need not have a main method as a web service is a service provider.
Change the java program as follows
package oracle.ws;
public class HelloWebService {
public String getValue(String name) {
return("Hello " + name + " Welcome to test web service");
}
}
Now select the java class file right click on it and say generate j2ee web service as shown in the picture
Choose j2ee 1.4
Provide some logical name to it
Let the default options be there and keep saying next
Now a wsdl will be created for you in the jdeveloper as follows
Start oc4j.bat for jdeveloper
You will get an output in jdeveloper utility as follows
Ready message received from Oc4jNotifier.
Embedded OC4J startup time: 16062 ms.
Target URL -- http://localhost:8988/WebService-WSProject-context-root/HelloWebServiceSoapHttpPort
10/01/08 21:03:04 Web service HelloWebService has been started on the embedded server
10/01/08 21:03:04 Oracle Containers for J2EE 10g (10.1.3.4.0) initialized
Warning : Not able to reserve 2048M memory for the heap. Heap reduced to 813M
Now open the URL given you will get a pgae like this
Provide an input and invoke the web service
======================================================================================
Using a client to invoke the process
Just select the wsdl file thus created right click on it and say create a proxy client
following screen will come up just say yes to it
next
Cleint code will be generated for you by the jdeveloper
open the client java program
and call the method
System.out.println("output is " + myPort.getValue("arpit"));
Run the programme and youi will get the following output in the jdev console.
the output will be
calling http://10.10.10.10:8988/WebService-WSProject-context-root/HelloWebServiceSoapHttpPort
output is Hello arpit Welcome to test web service
.
2 comments:
i am getting error java.util.nosuchelemntfound
when i am clicking on finish while creating web service like this
plz help
This is generic issue.You verify your java code.
Instead of jdeveloper check it directly from command console (set classpath and path) if you are able to compile the .java file.
Post a Comment