mcapan
mcapan

Reputation: 21

Apache CXF (Mule) Invalid QName in mapping: SOAP-ENV:Client

I'm using Apache CXF 2.5.9 within Mule ESB 3.5.0 CE for a Web Service client. If the soap message validation fails on server I get a soap fault (naturally) that looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Fault xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
               xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
   <faultcode>SOAP-ENV:Client</faultcode>
   <faultstring>https://10.1.104.105:8444/DohvatiIzOIBaF2FAServiceTest: cvc-simple-type 1: element {http://www.apis-it.hr/fin/2008/elements/DohvatIzOIBa}OIB value '716500116650' is not a valid instance of type {http://www.apis-it.hr/fin/2008/types/f63}String11BrojType</faultstring>
   <faultactor>OIB CIS pristupni čvor</faultactor>
</soapenv:Fault>

..but when client side tries to unmarshall the fault I get this exception:

2014-12-13 13:52:34,199 [WARN] org.apache.cxf.phase.PhaseInterceptorChain - Interceptor for {http://www.apis-it.hr/fin/2010/services/DohvatiIzOIBaF2FAService}DohvatiIzOIBaF2ServicePortTypeService#{http://www.apis-it.hr/fin/2010/services/DohvatiIzOIBaF2FAService}DohvatiFOPoOIBu has thrown exception, unwinding now
java.lang.RuntimeException: Invalid QName in mapping: SOAP-ENV:Client
    at org.apache.cxf.staxutils.StaxUtils.readQName(StaxUtils.java:1399)
    at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.unmarshalFault(Soap11FaultInInterceptor.java:59)
    at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:46)
    at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:35)
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
    at org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:114)
    at org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage(CheckFaultInterceptor.java:69)
    at org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage(CheckFaultInterceptor.java:34)
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
    at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:801)

I want the CXF client to unmarshall the soap fault to exception. How to get around this error?

Upvotes: 2

Views: 5335

Answers (3)

Lonzak
Lonzak

Reputation: 9816

Alternativly you could use the CXF transform feature

You need: <entry key="faultcode" value="faultcode=soapenv:Client"/>

This will map the original invalid fault from the server into the following valid fault so that it can be accepted by the cxf client

<soapenv:Fault>
 <faultcode>soapenv:Client</faultcode>
 <faultstring>An error occurred</faultstring>
</soapenv:Fault>

Upvotes: 0

Alan Cruz
Alan Cruz

Reputation: 11

Try making SOAP-ENV:Client something like this 12345, making the fault code a number solved it for me.

Upvotes: 1

V&#237;ctor Romero
V&#237;ctor Romero

Reputation: 5115

Mule won't catch the exception itself. You should probably use a cxf fault interceptor. From there you can compose the message you are expecting.

Upvotes: 0

Related Questions