Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6243989
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T12:14:36+00:00 2026-05-24T12:14:36+00:00

I’m trying to create a generic web service that will always respond with OK,

  • 0

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 RawXMLInOutMessageReceiver, 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:

@WebService
public interface DummyService {
    @WebMethod String processMessage(Object obj);
}

and a simple implementaion:

@WebService(endpointInterface = "com.dummyservice.DummyService")
public class DummyServiceImpl implements DummyService {
    @Override
    public String processMessage(Object obj) {
        return "OK";
    }
}

I can successfully publish the service with javax.xml.ws.Endpoint#publish(...), but when I hit it with a simple SOAP request, e.g.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  <soapenv:Header/>
  <soapenv:Body>
   <derp/>
  </soapenv:Body>
</soapenv:Envelope>

I’m greeted with a SOAPFault stating Cannot find dispatch method for {}derp.

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?


EDIT
Thanks to the tip from McDowell, I was able to do this with a SOAPHandler:

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<QName> 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<SOAPElement> 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;
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T12:14:37+00:00Added an answer on May 24, 2026 at 12:14 pm

    I expect your service is expecting something of the form:

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                      xmlns:dum="http://yournamespace/">
      <soapenv:Header/>
      <soapenv:Body>
        <dum:processMessage>
         <!-- xsd:anyType -->
        </dum:processMessage>
      </soapenv:Body>
    </soapenv:Envelope>
    

    Add ?WSDL to your endpoint and inspect the operation input XML type and the namespaces.

    You might be able to do something with a logical handler (javadoc) to transform the incoming request to this form – I haven’t tried.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am trying to understand how to use SyndicationItem to display feed which is
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
I have just tried to save a simple *.rtf file with some websites and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.