From time to time I am evaluating a tool or framework for which I need a web service. Although there are examples of running serviuces available on the web, I don“t always have access to the web and sometimes you need some more control over the service so you can edit/influence the corresponding WSDL. For these cases I created the following class which is all you need to get a web service running on your local machine (assuming you have JDK1.6 installed).
All the source you need is the following:

JAVA:
  1. package nl.redstream.ws;
  2.  
  3. import javax.jws.WebService;
  4. import javax.jws.soap.SOAPBinding;
  5. import javax.jws.soap.SOAPBinding.Style;
  6. import javax.xml.ws.Endpoint;
  7.  
  8. /**
  9. * @author Pascal Alma
  10. */
  11.  
  12. @WebService
  13. public class EchoServer {
  14.  
  15.     @SOAPBinding(style = Style.DOCUMENT)
  16.     public String getEcho(String txt) {
  17.             return "echo: " + txt;
  18.         }
  19.  
  20.     public static void main(String[] args) {
  21.         EchoServer myServer = new EchoServer ();
  22.         Endpoint endpoint = Endpoint.publish(
  23.                 "http://localhost:8181/echo", myServer);
  24.     }
  25. }

When you run this class (and leave it running), you can point your browser to go to 'http://localhost:8181/echo?wsdl' and you receive the wsdl for the web service:

XML:
  1. <?xml version="1.0" encoding="UTF-8"?><!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.6 in JDK 6. --><!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.6 in JDK 6. --><definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://ws.redstream.nl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://ws.redstream.nl/" name="EchoServerService">
  2. <types>
  3.   <xsd:schema>
  4.     <xsd:import namespace="http://ws.redstream.nl/" schemaLocation="http://localhost:8181/echo?xsd=1"></xsd:import>
  5.   </xsd:schema>
  6. </types>
  7. <message name="getEcho">
  8.   <part name="parameters" element="tns:getEcho"></part>
  9. </message>
  10. <message name="getEchoResponse">
  11.   <part name="parameters" element="tns:getEchoResponse"></part>
  12. </message>
  13. <portType name="EchoServer">
  14.   <operation name="getEcho">
  15.     <input message="tns:getEcho"></input>
  16.     <output message="tns:getEchoResponse"></output>
  17.   </operation>
  18. </portType>
  19. <binding name="EchoServerPortBinding" type="tns:EchoServer">
  20.   <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"></soap:binding>
  21.   <operation name="getEcho">
  22.     <soap:operation soapAction=""></soap:operation>
  23.     <input>
  24.       <soap:body use="literal"></soap:body>
  25.     </input>
  26.     <output>
  27.       <soap:body use="literal"></soap:body>
  28.     </output>
  29.   </operation>
  30. </binding>
  31. <service name="EchoServerService">
  32.   <port name="EchoServerPort" binding="tns:EchoServerPortBinding">
  33.     <soap:address location="http://localhost:8181/echo"></soap:address>
  34.   </port>
  35. </service>
  36. </definitions>

You can now test your tool/ product by using this web service.