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 6672065
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:27:51+00:00 2026-05-26T03:27:51+00:00

In cases where a given SOAP header element has a given value (for example,

  • 0

In cases where a given SOAP header element has a given value (for example, if the value of the header tag “response” is “0”), I don’t want Apache CXF to return a response at all.

How can I do this? It appears that CXF makes the assumption that all calls will receive a response.

(I know this seems strange in a web services context, but if your transport is JMS, it seems less strange).

  • 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-26T03:27:52+00:00Added an answer on May 26, 2026 at 3:27 am

    I’ve been able to do this with an interceptor that aborts the interceptor chain.

    I’ve tested this with an HTTP config (WebSphere returns an empty 200) and an ActiveMQ config (no response comes back to the response queue).

    package my.super.interceptor;
    
    public final class Suppressor extends AbstractSoapInterceptor {
    
       public Suppressor() { super(Phase.SETUP); }
    
       @Override
       public void handleMessage(final SoapMessage message) throws Fault        
       {                       
    
         final boolean suppressResponse = this.suppressResponse(message);
    
         if(suppressResponse) {
             log.debug("-> Suppressing response");
             message.getInterceptorChain().abort();
         }
    
       //if you want to suppress both responses and faults, you need
       //to check them separately. 
       //Change this code to check headers for whatever criteria you want
       //(Note you may need to change the super(Phase...) )
       //The code's a bit messy here - just sketching out the idea for the answer
       private boolean suppressResponse(final Message message) {            
         final Fault fault = (Fault)message.getContent(Exception.class);
    
         if(fault != null) {
            final String faultMessage = fault.getMessage();
    
             return faultMessage.indexOf("Something-you-want-to-match") > 0;
    
         } else {
            final MessageInfo messageInfo = (MessageInfo)message.get("org.apache.cxf.service.model.MessageInfo");            
            final String operation = messageInfo.getOperation().getOutputName();            
    
            return operation.indexOf("Something-you-want-to-match") > 0;
         }
       }
    

    and your applicationContext.xml:

    <jaxws:endpoint ...>
      <jaxws:outInterceptors>
         <bean class="my.super.interceptor.Suppressor"/>
       </jaxws:outInterceptors>
       <jaxws:outFaultInterceptors>
         <bean class="my.super.interceptor.Suppressor"/>
       </jaxws:outFaultInterceptors>
    </jaxws:endpoint>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given a node, to find the next largest value, there are two cases: First:
I need to highlight, case insensitively, given keywords in a JavaScript string. For example:
I'm not satisfied with the answers given by the SOAP vs REST questions notably
I am bad with SOAP. A third party SOAP service gave me example code
Is there a good tool to generate unit test cases given say a .NET
Given something like this: var results = theElement.Element(Blah).Element(Whatever).Elements(Something); Is there an elegant way to
I have two test cases, one returns a value, the next is supposed to
Given I have an immutable class of which a GetHashCode() function has been written,
Given the following two cases, which one is preferable (If they're both bad, doing
My query is used in cases that (function() {...})(); Given that I am not

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.