wood burning stoves 2.0*
The moose likes Web Services and the fly likes Webservice using Websphere Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Webservice using Websphere" Watch "Webservice using Websphere" New topic
Author

Webservice using Websphere

Deepa More
Ranch Hand

Joined: May 22, 2006
Posts: 68
I am using Websphere 5.1, I want to create simple hello web service.
I have used webservices in apache axis. But not familiar with how to deploy it on websphere server.
Can anyone give me some ex. or instructions regarding how to do this?
Thanks
Pawan Pangty
Greenhorn

Joined: Aug 03, 2004
Posts: 8
Hope you find the following helpful.
In the WSAD 5.1, create a simple Web project and add the following java code in javasource folder.

com.source;
public Class HelloWorld {

public String getMessage(){

return "Hello World";
}
}
I am assuming that the Server is configured and the created Web Project is added to it.

Once, this is done..do the following :

1. Right click the HelloWorld.java and opt for option => Web Services => Generate WSDL Files
2. A box opens :Select the Web project (Current Project) where you want the WSDL to be generated. Click Next
3. Select the HelloWorld class as the java bean . Click next
4. Make sure the getMessage() method is selected in the Methods option
5. Style and Use ocument/Literal
6. Click finish.

The above will create :
1. An HelloWorld_SEI.java (Service End Interface = SEI) for the class HelloWorld.java in the same package as HelloWorld
This interface contains the methods exposed as Webservices.
2. A WSDL in the WebContent for the HelloWorld class in the WebContent which represents the above SEI.

Create the Client stubs for the HelloWorld Webservice. :
7. Navigate to WebContent/ wsdl/HelloWorld.wsdl file.
8. Right Click and navigate to => Web Services => Generate Client
9. Another box will open :
10. Keep the following values : Client proxy type : Java proxy; Check "Overwrite files without warning" and "Create folders when necessary" options......Click next
11. Select your Server and Web service runtime as IBMWebSphere 5.0.2 .
12. Select a different Client Web Project or create a new one . Click Next
13. Click Finish.

Run the Server.
Write an java class using the created stubs to access the Webservice method "getMessage()".

Hope this works for you.

Regards,
Pawan
Deepa More
Ranch Hand

Joined: May 22, 2006
Posts: 68
Hi pawan,
thanks for the reply. but where do i get option to do this.


1. Right click the HelloWorld.java and opt for option => Web Services => Generate WSDL Files
2. A box opens :Select the Web project (Current Project) where you want the WSDL to be generated. Click Next
3. Select the HelloWorld class as the java bean . Click next
4. Make sure the getMessage() method is selected in the Methods option
5. Style and Use ocument/Literal
6. Click finish.

The above will create :
1. An HelloWorld_SEI.java (Service End Interface = SEI) for the class HelloWorld.java in the same package as HelloWorld
This interface contains the methods exposed as Webservices.
2. A WSDL in the WebContent for the HelloWorld class in the WebContent which represents the above SEI.

Create the Client stubs for the HelloWorld Webservice. :
7. Navigate to WebContent/ wsdl/HelloWorld.wsdl file.
8. Right Click and navigate to => Web Services => Generate Client
9. Another box will open :
10. Keep the following values : Client proxy type : Java proxy; Check "Overwrite files without warning" and "Create folders when necessary" options......Click next
11. Select your Server and Web service runtime as IBMWebSphere 5.0.2 .
12. Select a different Client Web Project or create a new one . Click Next
13. Click Finish.
Prasanna Chennupati
Ranch Hand

Joined: Feb 09, 2006
Posts: 38
Hi Deepa,

You can use an IDE ,for example RAD ,WSAD

Currently I am using RAD with websphere to use web service.

In RAD, go to your class that you want to expose as a web service, right click on that class and follow Pawan's instructions.

Hope this helps you


Thanks,<br />Prasanna<br />SCJP1.4,SCWCD1.4,SCBCD1.3,SCDJWS,SCEA-1<br />IBM Certified Solution Developer -- WebSphere Portal V5.1(got 100%)
Deepa More
Ranch Hand

Joined: May 22, 2006
Posts: 68
Can I create web-services using an eclipse IDE?
Are there any plugins that I can download and use it? If there are, how can I use those plugins to create web-service?

Thanks
MeghnaN Shah
Greenhorn

Joined: Jan 31, 2011
Posts: 9
Hi,
I have created web service using wsdl in Blue MyEclipse IDE (right click .wsdl file->New web service).
Now I want to host it on WAS 7 server and test it with SOAP UI tool or Java code to check the response.

I have hardcoded the response in the Impl class.
Can someone help to implement the above requirement.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Webservice using Websphere