• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Webservice using Websphere

 
Deepa More
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Deepa More
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic