Tuesday, October 4, 2011

WebSphere & JAX-WS

What better for a novice like me to learn how to deploy Webservices on WebSphere than to try it using hello world.

Here's my code:

1. Web Service Endpoint Interface

/**
*
*/
package com.singtel.ma.rto;

import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;
/**
* @author Main Masrudyn
*
*/
//Service Endpoint Interface
@WebService
public interface RTO {


@WebMethod String getHelloWorldAsString(String name);

}


2. Web Service Endpoint Implementation

package com.singtel.ma.rto;


import javax.jws.WebMethod;
import javax.jws.WebService;

//Service Implementation
@WebService(endpointInterface = "com.singtel.ma.rto.RTO")
public class RTOImpl implements RTO {

public String getHelloWorldAsString(String name) {
return "Hello World JAX-WS " + name;
}

}

3. Deploy on WebSphere, choose Detailed:


4. Ensure Deploy Webservice


5. Click on Service providers - ensure listener start




6. Check the webservice is running : http://rhel55-32.mydomain.com:9080/RTO/RTOImplService/RTOImplService.wsdl