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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T09:00:53+00:00 2026-06-02T09:00:53+00:00

I am working on some web-services based application and I have a question about

  • 0

I am working on some web-services based application and I have a question about Apache CXF unmarshalling. In our project we use CXF 2.4.1 version.

When some SOAP request is incorrect (e.g. some field is text instead of numeric) CXF throws standard SOAPFaultException and SOAP response is built up with standard fields like:

<soap:Fault>
    <faultcode>soap:Client</faultcode>
    <faultstring>Unmarshalling Error: some field missing</faultstring>
</soap:Fault>

Project requirements says that in case of any fault system need to respond in other format, like:

<soap:body>
    <ResponseState>
        <ErrorCode>2732</ErrorCode>
        <ErrorMessage>Unmarshalling Error: some field missing</ErrorMessage>
        <ErrorDetails> some details </ErrorDetails>
        <some other fields>
        ...
    </ResponseState>
</soap:body>

So the question is: how can I override somehow this error handling and respond in my format, not default?

Thanks in advance.

P.S. I tried to look into some ValidationEventHandler principals, but it works in some other way in CXF 2.0 and higher.

  • 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-02T09:00:54+00:00Added an answer on June 2, 2026 at 9:00 am

    OK, So after lot of research I’ve found some ways of CXF error handling.

    *. ValidationEventHandler gives you possibility to throw your own exception instead of standard one. BUT you can’t change responding behavior and you can’t change SOAP response format.

    *. Another way to alter error handling is to create your own interceptor. CXF workflow is built on chain of interceptors. There’s 4 type of interceptors: inInterceptor, outInterceptor, inFaultInterceptor and outFaultInterceptor.

    Using some smart hacks you can change workflow through creating your own interceptor (with adding it to chain), and remove standard interceptor from chain (if you know it’s class name). So you can actually do anything you need.

    BUT as far as all these interceptors marshall response manually (xmlWriter.writeStartElement() etc) it could be a great challenge to write your own interceptors for each flow phase. It could be real huge bunch of work.

    Unfortunately, I haven’t found good reference about CXF interceptors.

    Another thing – if you need to return regular response instead of SOAPFaultException you may need additional information like: actual service that return this response, service parameters passed in request etc. I haven’t found this info in accessible parameters in interceptors. And, surely, by doing so you cheat client code that will return OK instead of real exception.

    *. Designing your wsdl’s with all params as text may be very not very good solution:

    a. Consumer of your services may be really confused if no data types and validation rules in wsdl.

    b. You’ll need to ‘reinvent the wheel’ for validation. I mean that you’ll need to code your own validator that could be very difficult with some complicated rules. At the same time XSD has all of this validations implemented and good tested.

    And finally about my situation: we discussed it with requirement manager and decided to allow CXF throw it’s own standard exceptions if XML schema requirements violated in request. It’s good solution because now we are using all the power of XSD validation and don’t waste our time on complicated and useless work.

    Great thanks to @ericacm for answer.

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

Sidebar

Related Questions

I'm working on a semantic web project and I've encountered some problems about Uri
I'm working on a class-based php web app. I have some places where objects
I'm working with some web services that have already been created and I need
When working on some Javascript for a web application, I noticed that I had
I've started working on some enhancements to an ASP.NET web forms e-commerce project, one
I'm working on a web application and need some help with a query. I'm
I'm working on an ASP.NET Web Project with some AJAX magic. As my GridView
I'm working on a MVC based web app on LAMP that needs some records
I'm working my way through some ASP.NET MVC reading and I have a web
I'm working on a Web Application in Visual Studio 2008. For some reason the

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.