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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T21:43:54+00:00 2026-06-12T21:43:54+00:00

I created a SOAP interceptor as described in CXF docs : public class SoapMessageInterceptor

  • 0

I created a SOAP interceptor as described in CXF docs:

public class SoapMessageInterceptor extends AbstractSoapInterceptor {
    public SoapMessageInterceptor() {
        super(Phase.USER_PROTOCOL);
    }
    public void handleMessage(SoapMessage soapMessage) throws Fault {
        // ...
    }
}

and registered it with the bus in Spring’s application context:

  <cxf:bus>
    <cxf:inInterceptors>
      <ref bean="soapMessageInterceptor"/>
    </cxf:inInterceptors>
  </cxf:bus>

  <jaxws:endpoint id="customerWebServiceSoap"
        implementor="#customerWebServiceSoapEndpoint"
        address="/customerService"/>

All was working fine until I added a REST service:

  <jaxrs:server id="customerWebServiceRest" address="/rest">
    <jaxrs:serviceBeans>
      <ref bean="customerWebServiceRestEndpoint" />
    </jaxrs:serviceBeans>
  </jaxrs:server>

The problems is that the SOAP interceptor is now being triggered on REST requests also, which results in a class cast exception when the REST service is invoked.

<ns1:XMLFault xmlns:ns1="http://cxf.apache.org/bindings/xformat">
  <ns1:faultstring xmlns:ns1="http://cxf.apache.org/bindings/xformat">
    java.lang.ClassCastException: org.apache.cxf.message.XMLMessage
    cannot be cast to org.apache.cxf.binding.soap.SoapMessage
  </ns1:faultstring>
</ns1:XMLFault>

Is there any way to restrict the interceptor to SOAP messages only through configuration?

Update

Looks like I missed the page in the docs that describes this.
Scroll down to Difference between JAXRS filters and CXF interceptors

  • 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-06-12T21:43:55+00:00Added an answer on June 12, 2026 at 9:43 pm

    You can attach interceptors to an individual endpoint rather than to the bus:

    <jaxws:endpoint id="customerWebServiceSoap"
        implementor="#customerWebServiceSoapEndpoint"
        address="/customerService">
      <jaxws:inInterceptors>
        <ref bean="soapMessageInterceptor"/>
      </jaxws:inInterceptors>
    </jaxws:endpoint>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created a Web Service use CXF with 1.2 soap binding. when i try
I have created an android application that calls (using kSOAP library) a SOAP based
I created a WCF SOAP service using VS 2008 that works server side. I
I've created a simple SOAP web service using soaplib and run into an issue
I created on wcf web service and trying to test with SOAP UI. When
I have created a WCF VB.Net Soap service. The service compiles and runs, but
I have created a delphi 7 program and connected to sugarcrm with soap wsdl.
I've created an app that interacts with a SOAP service using java WS. I
I'm using Delphi 2010 to create a SOAP Server. The server is created as
I am generating a SOAP client for a SOAP webservice. I created Java stubs

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.