Creating a SOAP Service using JAX-WS Annotations
It is possible to create SOAP webservices with only a few lines of code using the JAX-WS annotations. In a productivity environment you might prefer using contract-first instead of code-first to create your webservice but for now we’re going to use the fast method and that means code-first and annotations olé! Creating the SOAP Service Create a class SampleService with two public methods Annotate this class with @WebService (javax.jws.WebService) – now all public methods of this class are exported for our SOAP service To change the name of an exported method, annotate the method with @WebMethod(operationName = “theDesiredName”) (javax.jws.WebMethod) Finally the service class could look like this package com.hascode.tutorial.soap; import javax.jws.WebMethod; import javax.jws.WebService; @WebService public class SampleService { @WebMethod(operationName = "getInfo") public String getInformation() { return "hasCode.com"; } public String doubleString(String inString) { return inString + inString; } } ...