Java Reference
In-Depth Information
Create the web service
1. Under Java Resources, choose the srcdirectory, right click, and create a New Package.
I've named mine com.soacookbook .
2. Right-click on your package, and choose New WebLogic Web Service.
3. In the Filename field, enter HelloWS and finish the wizard.
Now you have a new web service class. Modify the contents of the class to look like this:
@WebMethod
public String sayHello(String name) {
return "Hello, " + name;
}
Now you need to create the WSDL for the web service.
Deploy the web service
Now that you have a complete web service, you're ready to deploy it to your WebLogic server.
Here are the simple steps to do that:
1. Right-click on the web service implementation class itself (here, HelloWS.java ) and
choose Run As→Run On Server.
2. Choose the local WebLogic server that you installed earlier and click Finish.
Test the service using the built-in test client
Like Glassfish, WebLogic Workshop comes with an easy way to test a web service. When you
deploy and run the service through Workshop, it will automatically create a simple graphical
client that allows you to test your service.
So after the deploy step, Workshop should launch a screen similar to that shown in Figure 4-7 .
It shows your web service operation and allows you to enter a value and get a response. In
both cases, the SOAP message is shown.
Search WWH ::




Custom Search