This topic defines how to create SOAP WS in simple standard steps.

Step 1: Prepare the logic to be exposed as Webservice

  1. Construct a Interface with @WebService & @SoapBinding annotation for the method or operation to be exposed as WebService with annotation @WebMethod.



//use javax.jws package.

@SOAPBinding(style = Style.DOCUMENT, use = Use.LITERAL) // optional
public interface IRandomUUID {
                @WebMethod public long getUUID();

2. Implement the Interface with annotating definition for end point interface.



@WebService(endpointInterface = “”)

public class RandomUUID implements IRandomUUID {

public long getUUID() {
return UUID.randomUUID().timestamp();


Step 2: Expose logic as Web Service

Convert Class into WSDL

In Eclipse IDE,

Right Click on your Dynamic Web Project, New -> Other -> Web Service -> Next

  1. Browse the Class (here it is,
  2. Check ‘Publish the Web Service‘ and Click Next.
  3. All the method with annotated with @WebMethod will be lsited and checked by default. De-Select the method which you dont need to expose and Click Next.
  4. Check the ‘Launch the Web Services Explorer to publish this Web Service to a UDDI Registry‘ if you want UDDI Registry and click Finish.
  5. Now SOAP Web Services for class ie., for RandomUUID here is created successfully.
  6. Goto  WebContent -> wsdl find ClassName.wsdl file here, RandomUUID.wsdl
  7. find location for ws access in <wsdlsoap:address> for the location


<wsdl:service name=”RandomUUIDService”>

<wsdl:port binding=”impl:RandomUUIDSoapBinding” name=”RandomUUID”>

<wsdlsoap:address location=”http://localhost:8090/RandomWS/services/RandomUUID“/>




Now your logic is ready for deployment, deploy the archive on to server .

Check the browser for location postfixed with ?wsdl



Now, you should be able to view the generated WSDL  & SOAP WebService is ready !!!!