CXF Camel route not returning SOAP fault
dhoyt Mar 10, 2011 6:20 PMWhat I am trying to do is to take a SOAP request and, if the request returns successfully (does not generate a SOAP fault), publish the body of the SOAP request to a JMS topic. I have tried to accomplish this by using a multicast with stopOnException. The problem is that when it stops on the SOAP fault, nothing is returned to the caller. If no fault is generated or if stopOnException is removed, the response is returned properly.
I noticed that the following exception was listed in the servicemix log which may be related.
16:36:33,213 | WARN | qtp7991293-2025 | PhaseInterceptorChain | - - | Interceptor for MemberServiceService#updateMember has thrown exception, unwinding now
java.lang.NullPointerException
at org.apache.cxf.interceptor.FaultOutInterceptor.getFaultForClass(FaultOutInterceptor.java:149)[138:org.apache.cxf.bundle:2.3.2.fuse-00-00]
at org.apache.cxf.interceptor.FaultOutInterceptor.handleMessage(FaultOutInterceptor.java:64)[138:org.apache.cxf.bundle:2.3.2.fuse-00-00]
at .......
Below is my configure method and aggregation strategy. If there is something I'm missing or an easier/better way of doing this, please let me know.
Thanks,
Daryl
public void configure() throws Exception
{
AggregationStrategy aStrat = new FirstResponseAggregationStrategy();
from("cxf://http://0.0.0.0:1013/CxfTest" + //
"?portName={http://example.test.com/}TestMemberServicePort" + //
"&serviceName=TestMemberServiceService" + //
"&wsdlURL=classpath:TestMemberService.wsdl" + //
"&dataFormat=PAYLOAD" + //
"&loggingFeatureEnabled=true") //
.multicast(aStrat).stopOnException()
.to("nmr:CxfTestNmr") //
.to("nmr:logTest")
.end();
;
from("nmr:logTest")
.log("\n\n\n\n\n\nGot to Log Message\n\n\n\n\n\n");
from("nmr:CxfTestNmr") //
.to("cxf://http://remoteHost:8080/TestVersion/TestMemberService" + //
"?portName=TestMemberServicePort" + //
"&serviceName=TestMemberServiceService" + //
"&wsdlURL=classpath:TestMemberService.wsdl" + //
"&dataFormat=PAYLOAD" + //
"&loggingFeatureEnabled=true") //
;
}
public static class FirstResponseAggregationStrategy implements AggregationStrategy
{
@Override
public Exchange aggregate(Exchange oldExchange, Exchange newExchange)
{
return (oldExchange == null) ? newExchange : oldExchange;
}
}