Create Simple Web Service JAX-WS – Server Part – RAD IBM – Websphere 7.0 + java 6

1). Create Simple Web Service JAX-WS – RAD IBM – Websphere 7.0 + java 6

1.1) Create your ear File first – Select New > Enterprise Application Project – “jaxwsServerEar” – Server Web Service  Part  1

1.2.) Create New Java Project – Select New > Dynamic Web Project– “jaxwsServerFirst

1ws1.png

1.3) create your Interface class with package. Create Package – com.fndong.service  / create your Class web Service “SalaryService” ( The interface will list calculate the salary and allowance)

package com.fndong.service;

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

/**
 * @author fndong
 *
 */
@WebService
public interface SalaryService {
     @WebMethod
     public int calculateSalaryAllowance(double salary, double allowance);
}
  • The @WebService annotation marks the WebServiceFirst class as implementing a web service, which results in a deployable web service being produced.
  • The @WebMethod

1.4.) Create implementation class to calculate Salary and Allowance – “SalaryImpl

package com.fndong.Impl;

import com.fndong.service.SalaryService;

/**
 * @author fndong
 *
 */
@WebService(endpointInterface="com.fndong.service.SalaryService")
public class SalaryImpl implements SalaryService {
     
    public double calculateSalaryAllowance(double salary, double allowance) {
         return salary + allowance;
}


}

1.5.) Create Web Service for the Implementation Class “SalaryImp” by right SalaryImp > Web Services> create WebServices

2ws1.png

  • Next > check the box – Generate WSDL file into the project.

3ws1.png

 

 

 

 

 

 

 

 

 

 

 

Next > Next > Finish

1.6.) The Class “SalaryImplDelegate.java” will generated automatically and also WSDL files. ( Check inside WebContent Folder)

4ws1.png

1.7.) The server started and test the result and also validate the WSDL.

5ws1.png

1.7.1.) check the WSDL document in the browser.

http://localhost:9080/jaxws/SalaryImplService?wsdl

6ws1.png

1.8.) Test with WebServices Explorer, just right click wsdl->WebServices->Test with WebServices Explorer

7ws1.png

1.9.) It will load the page in your RAD . You test the result of calculation between Salary and Allowance, for arg0 = 3000 and arg1 = 50 , Click Go Button, so the result at the Status – Body:

8ws1.png

Selamat Mencuba (malay languange)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s