title: Can I create a generic web service/dispatch method that responds to ALL requests with JAX-WS?
body: <p>I'm trying to create a generic web service that will always respond with "OK", regardless of the request's header or body contents.  I can do this in Axis2 with a <code>RawXMLInOutMessageReceiver</code>, but I'd prefer to use JAX-WS (which I am completely new to) if at all possible.  So far I've got a simple interface:</p>
  
  <pre><code>@WebService
  public interface DummyService {
      @WebMethod String processMessage(Object obj);
  }
  </code></pre>
  
  <p>and a simple implementaion:</p>
  
  <pre><code>@WebService(endpointInterface = "com.dummyservice.DummyService")
  public class DummyServiceImpl implements DummyService {
      @Override
      public String processMessage(Object obj) {
          return "OK";
      }
  }
  </code></pre>
  
  <p>I can successfully publish the service with <code>javax.xml.ws.Endpoint#publish(...)</code>, but when I hit it with a simple SOAP request, e.g.</p>
  
  <pre><code>&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"&gt;
    &lt;soapenv:Header/&gt;
    &lt;soapenv:Body&gt;
     &lt;derp/&gt;
    &lt;/soapenv:Body&gt;
  &lt;/soapenv:Envelope&gt;
  </code></pre>
  
  <p>I'm greeted with a SOAPFault stating <code>Cannot find dispatch method for {}derp</code>.</p>
  
  <p><strong>Is it even possible to create a generic/dumb web service that will ACK everything with JAX-WS?  If so, could someone point me in the right direction?</strong></p>
  
  <hr>
  
  <p><strong>EDIT</strong>
  Thanks to the tip from McDowell, I was able to do this with a <code>SOAPHandler</code>:</p>
  
  <pre><code>public class DummySOAPHandler implements SOAPHandler {
  
      @Override
      public boolean handleMessage(MessageContext context) {
          return process((SOAPMessageContext) context);
      }
  
      @Override
      public boolean handleFault(MessageContext context) {
          return process((SOAPMessageContext) context);
      }
  
      @Override
      public void close(MessageContext context) { }
  
      @Override
      public Set&lt;QName&gt; getHeaders() {
          return null;
      }
  
      private boolean process(SOAPMessageContext ctx) {
  
          try {
              SOAPMessage message = ctx.getMessage();
              SOAPEnvelope envelope = message.getSOAPPart().getEnvelope();
              SOAPBody body = message.getSOAPBody();
  
              if ((Boolean) ctx.get (MessageContext.MESSAGE_OUTBOUND_PROPERTY)) {
                  Iterator&lt;SOAPElement&gt; bodyChildren = body.getChildElements();
                  while (bodyChildren.hasNext()) {
                      SOAPElement child = bodyChildren.next();
                      child.detachNode();
                  }
  
                  body.addBodyElement(envelope.createName("OK"));
                  message.saveChanges();
              }
          } catch (SOAPException e) {
              e.printStackTrace();
          }
  
          return true;
      }
  }
  </code></pre>