• Entries (RSS)
  • Comments (RSS)

Creating a webservice using RAD 7

Posted by | Posted in RAD | Posted on 27-07-2008

Tagged Under : , , ,

Creating a webservice using RAD 7

Few months back I had posted about webservice Hello World tutorial in Java. At that time I did not find any simple tutorial on how to create a Hello World webservice in Java. Today I will explain how to create a simple webservice in Java using Rational Application Developer version 7(The steps will be almost same for RAD 6 also).

First create a project for our webservice. I just named my project as WebService. Then we need a class for our webservice. We will be exposing this class as our webservice. I have created a class HelloWorld.java with one sayHello method in it. The complete code listing for our HelloWorld.java is given below.

package com.test;
 
public class HelloWorld {
	public String sayHello(String name){
		return "Hello "+name;
	}
}

The next step is to expose this HelloWorld.java as our web service. Right click on the Project and click on New. Click on Other if your ‘Web Services’ folder is not listed. Expand the ‘Web Services’ folder and select Web Service

Click on Next. The Web Service creation wizard opens up. From the next page opened, select HelloWorld.java as our service implementation and the server types.

Click on Next.

Click on Next.

Click on Next.

Click on Finish. You are done with your HelloWorld web service using RAD 7.

Share

Read More

Comments

22 comments posted onCreating a webservice using RAD 7

  1. how to execute this code

  2. Good question. If you just need to test the webservice you created, you can use the web services explorer. To use the web services explorer, navigate to your Web Content/wsdl folder. Right click on the wsdl files generated and select Web Services -> Test with Web Services explorer. This would open the web services explorer in a new web browser. Click on your service find out the method you want to test. In our case it will be sayHello. Click on the sayHello method and from the right pane enter provide an input to the method and click on Go. You will be able to see the result of your hello world web service output.

    If you need to test the web service using your own client, follow the steps in http://www.albeesonline.com/blog/2008/01/29/generating-a-web-service-proxy-client/ . Once you have generated the client use the proxy classes to call your web service.

  3. [...] Before you start, please make sure that you have generated the web service client as mentioned in Generate web service proxy client in java. If you do not have the Hello World web service running in your server, follow the tutorial at Creating a Hello World web service using RAD. [...]

  4. Very Nice article. Thanks!

  5. Please provide steps to create JMS webservices using websphere V6.0, RAD7

  6. I would like to use return types such as Map, List in my Java bean class that i am converting to a web service. I believe that JAX-RPC doesnt support these types – is there a way around using RAD 7 ? I tried using Axis as the runtime environment – with little success though.

  7. hi

    i am new to web services and i trying to create a service as you said above.
    but i am geting an error saying ” IWAB0014E Unexpected exception occured.”
    how am i suppose to proceed further..

    Can you send me any online link where i can get web service materials.

    Regards
    Sant

  8. I am not sure why this error is happening. Please have a look into this link http://www-01.ibm.com/support/docview.wss?uid=swg21237672 . If this is not working, please make sure that you have your RAD up to date. Just install the fixpacks if you have missed some.

  9. hi joseph

    thank you for the response
    i am trying to create the wsdl and i’ve got no clue how to goahead about this.
    can u guide me with some material for creating the webservices in java.

  10. If you create a web service as I have mentioned in my post, you will be able to see a WSDL file in WEB-INF directory of your web project.

    For the material I would recommend you to do a search in RAD infocenter.

  11. I just did word-for-word for what you mentioned above.

    Getting this error after I try to invoke the webservice using the Web Service Explorer.

    [8/26/09 15:16:53:919 EDT] 00000029 EngineConfigu E org.apache.commons.logging.impl.Jdk14Logger error WSWS3345E: Error: Unable to locate a valid EngineConfigurationFactory.
    [8/26/09 15:16:53:934 EDT] 00000029 ServletWrappe E SRVE0068E: Uncaught exception thrown in one of the service methods of the servlet: com_test_HelloWorld. Exception thrown : javax.servlet.ServletException: WSWS3142E: Error: Could not find Web services engine.
    at com.ibm.ws.webservices.engine.transport.http.WebServicesServlet.doPost(WebServicesServlet.java:637)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
    at com.ibm.ws.webservices.engine.transport.http.WebServicesServletBase.service(WebServicesServletBase.java:341)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:966)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)
    at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:463)
    at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3129)
    at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:238)
    at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:811)
    at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1433)
    at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:93)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:465)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:394)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:274)
    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
    at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:152)
    at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:213)
    at com.ibm.io.async.AbstractAsyncFuture.fireCompletionActions(AbstractAsyncFuture.java:195)
    at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
    at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:194)
    at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:741)
    at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:863)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1510)

    [8/26/09 15:16:53:965 EDT] 00000029 WebApp E [Servlet Error]-[com_test_HelloWorld]: javax.servlet.ServletException: WSWS3142E: Error: Could not find Web services engine.
    at com.ibm.ws.webservices.engine.transport.http.WebServicesServlet.doPost(WebServicesServlet.java:637)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
    at com.ibm.ws.webservices.engine.transport.http.WebServicesServletBase.service(WebServicesServletBase.java:341)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:966)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)
    at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:463)
    at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3129)
    at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:238)
    at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:811)
    at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1433)
    at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:93)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:465)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:394)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:274)
    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
    at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:152)
    at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:213)
    at com.ibm.io.async.AbstractAsyncFuture.fireCompletionActions(AbstractAsyncFuture.java:195)
    at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
    at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:194)
    at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:741)
    at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:863)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1510)

    [8/26/09 15:27:02:907 EDT] 00000029 EngineConfigu E org.apache.commons.logging.impl.Jdk14Logger error WSWS3345E: Error: Unable to locate a valid EngineConfigurationFactory.
    [8/26/09 15:27:02:907 EDT] 00000029 ServletWrappe E SRVE0068E: Uncaught exception thrown in one of the service methods of the servlet: com_test_HelloWorld. Exception thrown : javax.servlet.ServletException: WSWS3142E: Error: Could not find Web services engine.
    at com.ibm.ws.webservices.engine.transport.http.WebServicesServlet.doPost(WebServicesServlet.java:637)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
    at com.ibm.ws.webservices.engine.transport.http.WebServicesServletBase.service(WebServicesServletBase.java:341)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:966)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)
    at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:463)
    at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3129)
    at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:238)
    at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:811)
    at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1433)
    at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:93)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:465)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:394)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:274)
    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
    at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:152)
    at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:213)
    at com.ibm.io.async.AbstractAsyncFuture.fireCompletionActions(AbstractAsyncFuture.java:195)
    at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
    at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:194)
    at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:741)
    at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:863)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1510)

    [8/26/09 15:27:02:938 EDT] 00000029 WebApp E [Servlet Error]-[com_test_HelloWorld]: javax.servlet.ServletException: WSWS3142E: Error: Could not find Web services engine.
    at com.ibm.ws.webservices.engine.transport.http.WebServicesServlet.doPost(WebServicesServlet.java:637)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
    at com.ibm.ws.webservices.engine.transport.http.WebServicesServletBase.service(WebServicesServletBase.java:341)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:966)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)
    at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:463)
    at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3129)
    at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:238)
    at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:811)
    at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1433)
    at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:93)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:465)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:394)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:274)
    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
    at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:152)
    at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:213)
    at com.ibm.io.async.AbstractAsyncFuture.fireCompletionActions(AbstractAsyncFuture.java:195)
    at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
    at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:194)
    at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:741)
    at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:863)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1510)

  12. :mrgreen:

  13. 500
    Internal Server Error

    Wen I tested the service with “Web Services explorer”.

  14. Hello sir..
    We have created web services for hello world but while trying to execute that we are getting some error as IWAB0135E An unexpected error has occurred.
    IOException
    Connection refused: connect

    can you say pls why this error occurs and give a remedy for this…..

  15. Hi,

    I am using RAD 7.5 and the steps seems to be different. It does not asking for end points and bean details.

    Appreciate if you can direct me?

    Thanks for your help.

  16. Hi,
    i found ur tutorial useful .but i want to know how to call webservice in java main method.
    Error is coming..Exception in thread “main” javax.xml.ws.WebServiceException: Failed to access the WSDL at: file:./WEB-INF/wsdl/HelloWorldService.wsdl. It failed with:
    .\WEB-INF\wsdl\HelloWorldService.wsdl (The system cannot find the path specified.).

    i m using RAD 7.5

    Please help

  17. IWAB0014E Unexpected exception occured.

    java.lang.NullPointerException
    at org.eclipse.jst.ws.internal.common.J2EEUtils.isComponentAssociated(Unknown Source)
    at org.eclipse.jst.ws.internal.common.J2EEUtils.isComponentAssociated(Unknown Source)
    at org.eclipse.jst.ws.internal.consumption.command.common.AssociateModuleWithEARCommand.execute(Unknown Source)
    at org.eclipse.jst.ws.internal.creation.ui.extension.PreServiceAssembleCommand.execute(Unknown Source)
    at org.eclipse.wst.command.internal.env.core.fragment.CommandFragmentEngine.runCommand(Unknown Source)
    at org.eclipse.wst.command.internal.env.core.fragment.CommandFragmentEngine.visitTop(Unknown Source)
    at org.eclipse.wst.command.internal.env.core.fragment.CommandFragmentEngine.moveForwardToNextStop(Unknown Source)
    at org.eclipse.wst.command.internal.env.ui.widgets.SimpleCommandEngineManager$5.run(Unknown Source)
    at org.eclipse.jface.operation.ModalContext.runInCurrentThread(Unknown Source)
    at org.eclipse.jface.operation.ModalContext.run(Unknown Source)
    at org.eclipse.jface.wizard.WizardDialog.run(Unknown Source)
    at org.eclipse.wst.command.internal.env.ui.widgets.SimpleCommandEngineManager.runForwardToNextStop(Unknown Source)
    at org.eclipse.wst.command.internal.env.ui.widgets.WizardPageManager.runForwardToNextStop(Unknown Source)
    at org.eclipse.wst.command.internal.env.ui.widgets.WizardPageManager.performFinish(Unknown Source)
    at org.eclipse.wst.command.internal.env.ui.widgets.DynamicWizard.performFinish(Unknown Source)
    at org.eclipse.jface.wizard.WizardDialog.finishPressed(Unknown Source)
    at org.eclipse.jface.wizard.WizardDialog.buttonPressed(Unknown Source)
    at org.eclipse.jface.dialogs.Dialog$3.widgetSelected(Unknown Source)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(Unknown Source)
    at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
    at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Unknown Source)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
    at org.eclipse.jface.window.Window.runEventLoop(Unknown Source)
    at org.eclipse.jface.window.Window.open(Unknown Source)
    at org.eclipse.ui.actions.NewWizardAction.run(Unknown Source)
    at org.eclipse.jface.action.Action.runWithEvent(Unknown Source)
    at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(Unknown Source)
    at org.eclipse.jface.action.ActionContributionItem.access$2(Unknown Source)
    at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(Unknown Source)
    at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
    at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Unknown Source)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
    at org.eclipse.ui.internal.Workbench.runEventLoop(Unknown Source)
    at org.eclipse.ui.internal.Workbench.runUI(Unknown Source)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Unknown Source)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(Unknown Source)
    at org.eclipse.ui.internal.ide.IDEApplication.run(Unknown Source)
    at org.eclipse.core.internal.runtime.PlatformActivator$1.run(Unknown Source)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(Unknown Source)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(Unknown Source)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(Unknown Source)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.core.launcher.Main.invokeFramework(Unknown Source)
    at org.eclipse.core.launcher.Main.basicRun(Unknown Source)
    at org.eclipse.core.launcher.Main.run(Unknown Source)
    at org.eclipse.core.launcher.Main.main(Unknown Source)
    I am getting this error when I click on finish

  18. hi runa i am also facing the same problem…could u assist me how to go through this example in rad 7.5?

  19. When I gave a string input and slick on go to see the result I found the below error. let me know if I miss anything.

    IWAB0135E An unexpected error has occurred.
    404
    Not Found

  20. While running by giving a
    string input I got the below error.

    IWAB0135E An unexpected error has occurred.
    404
    Not Found

    Please let me know what could be the issue.

  21. I believe your webservice is not deployed correctly.

  22. Hi Albin. I am using jax-rpc in my project to create a webservice. Whenever i put a complex type object (Return type of the method is a custom object. Inside the custome object, i have another custom object array), i am getting “Error: Null serializer factory specified in the TypeMappingImpl.register method.” Only if i put the concerned custom object (used for object array) class in the same path as the service class, this issue is resolved.

    Can you provide a solution for this?

Post a Comment