The annotation @WebService tells the
server runtime environment to expose all public methods on that bean as a
Web service. In below example, all the public methods in the web service will be exposed as web methods.
suppose that you do not need to expose the addNewHotel method as a web service operation method. but the default implementation of the @WebService method will expose all public methods as web service operations. but there is a special annotation that will prevent the method by exposing/publishing as a web service operation.
Refer the below class and try to publish the web service.
here the addNewHotel method will not be exposed or published as a web service operation/method.
i hope that this will be helpful for you!
Cheers
Chathuranga Tennakoon
chathuranga.t@gmail.com
www.chathurangaonline.com
package com.chathurangaonline.sample.jax.ws;
import javax.jws.WebService; import com.chathurangaonline.sample.model.Hotel;
@WebService public class HotelWebService{
public Hotel retriveHolelByCity(String cityName) { //todo implementation should goes here return new Hotel();
} public void addNewHotel(Hotel hotel) { //todo implementation should goes here } }
suppose that you do not need to expose the addNewHotel method as a web service operation method. but the default implementation of the @WebService method will expose all public methods as web service operations. but there is a special annotation that will prevent the method by exposing/publishing as a web service operation.
@WebMethod(exclude = true)
Refer the below class and try to publish the web service.
package com.chathurangaonline.sample.jax.ws;
import javax.jws.WebService; import com.chathurangaonline.sample.model.Hotel;
@WebService public class HotelWebService{
public Hotel retriveHolelByCity(String cityName)
//todo implementation should goes here return new Hotel(); } @WebMethod(exclude = true) public void addNewHotel(Hotel hotel) { //todo implementation should goes here } }
here the addNewHotel method will not be exposed or published as a web service operation/method.
i hope that this will be helpful for you!
Cheers
Chathuranga Tennakoon
chathuranga.t@gmail.com
www.chathurangaonline.com
Hi there! Outstanding post. Thanks for referring to a very exciting and useful content, it is a big help to me and to others as well, keep it up! web designing services
ReplyDeleteHi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here.
ReplyDeleteKindly keep blogging. If anyone wants to become a Java developer learn from Java EE Online Training from India.
or learn thru Java EE Online Training from India . Nowadays Java has tons of job opportunities on various vertical industry.