Announcement Announcement Module
No announcement yet.
Web Service Exception Handling Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Web Service Exception Handling

    My apologies for the long email.

    I am new to web services but have been somewhat successful in creating a custom spring ws. I am now trying to map a business exception to the service by utilizing the SoapFaultMappingExceptionResolver.

    Currently my exceptionResolver bean is configured like so:

    <bean id="exceptionResolver"
    class=" .SoapFaultMappingExceptionResolver">
    <property name="defaultFault" value="SERVER" />
    <property name="exceptionMappings">
    <value>com.userapp.exception.UserNotFoundException =CLIENT,User Does Not Exist</value>

    Can someone tell me how to use a custom Fault-Code? When I try to do:

    <bean id="exceptionResolver"
    class=" .SoapFaultMappingExceptionResolver">
    <property name="defaultFault" value="SERVER" />
    <property name="exceptionMappings">
    <value>com.userapp.exception.UserNotFoundException =CUSTOM_CODE,User Does Not Exist</value>

    I get the following error:

    faultCode's namespaceUri cannot be empty
    at org.springframework.util.Assert.hasLength(Assert.j ava:136)
    at dFault(
    at ctSoapFaultDefinitionExceptionResolver.resolveExce ptionInternal(AbstractSoapFaultDefinitionException
    at pointExceptionResolver.resolveException(AbstractEn
    at ocessEndpointException(
    at spatch(
    at ceive(
    at eMessageReceiverObjectSupport.handleConnection(Web
    at ssageReceiverHandlerAdapter.handle(WebServiceMessa
    at tcherServlet.doService(MessageDispatcherServlet.ja va:230)
    at org.springframework.web.servlet.FrameworkServlet.p rocessRequest(
    at org.springframework.web.servlet.FrameworkServlet.d oPost(
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:710)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:803)
    at ternalDoFilter(
    at Filter(
    at org.apache.catalina.core.StandardWrapperValve.invo ke(
    at org.apache.catalina.core.StandardContextValve.invo ke(
    at org.apache.catalina.core.StandardHostValve.invoke(
    at org.apache.catalina.valves.ErrorReportValve.invoke (
    at org.apache.catalina.core.StandardEngineValve.invok e(
    at org.apache.catalina.connector.CoyoteAdapter.servic e(
    at org.apache.coyote.http11.Http11Processor.process(H
    at org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.process(

    We are trying to map each of our business exceptions to a unique code so that the applications that consume our web service will be able to handle the fault appropriately (display a user friendly error based on the code returned).

    Thank you in advance for your help.

  • #2
    Hey All -
    I was able to figure it out by setting the following in exceptionResolver bean configuration:

    <bean id="exceptionResolver"
    class=" .SoapFaultMappingExceptionResolver">
    <property name="defaultFault" value="SERVER" />
    <property name="exceptionMappings">
    <value>com.custom.exception.CustomExceptionClass={ http://custom/name/space}cns:CUSTOM_CODE,Custom Exception Thrown</value>

    It's amazing what happens when you read a little documentation