After doing some research I found out that the same scenario is working when I am using CXF instead of XFire (cxf-wsdl-first example). I was really surprised that ServiceMix XFire is not working correctly with something basic like faults.
Which servicemix component should I use for building a web service in general? Are there any best practices which framework to choose? Pro and cons XFire vs. CXF? Thanks, Martin Sitz der Gesellschaft / Corporate Headquarters: Lufthansa Systems Business Solutions GmbH, Raunheim, Registereintragung / Registration: Amtsgericht Darmstadt 83850 Geschaeftsfuehrung / Management Board: Bernd Appel -----Ursprüngliche Nachricht----- Von: GROSS, MARTIN Gesendet: Montag, 23. Juni 2008 19:55 An: '[email protected]' Betreff: XFireRuntimeException while running example wsdl_first with Fault Hi, I am using ServiceMix 3.2.1 . I created a JSR181 web service with some custom defined faults. As I got an XFireRuntimeException when a fault was created I tried the provided ServiceMix wsdl_first example to find out what is wrong with my service. When I run the wsdl_first example (apache-servicemix-3.2.1\examples\wsdl-first) as described with the client.html. Everything is ok as long as I use preset values like: <?xml version="1.0" encoding="UTF-8"?> <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns="http://servicemix.apache.org/samples/wsdl-first/types"> <env:Body> <tns:GetPerson> <tns:personId>world</tns:personId> </tns:GetPerson> </env:Body> </env:Envelope> The result is as it should be: STATUS: 200 <?xml version='1.0' encoding='UTF-8'?><env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Body><GetPersonResponse xmlns="http://servicemix.apache.org/samples/wsdl-first"><personId xmlns="http://servicemix.apache.org/samples/wsdl-first/types">world</personId><ssn xmlns="http://servicemix.apache.org/samples/wsdl-first/types">000-000-0000</ssn><name xmlns="http://servicemix.apache.org/samples/wsdl-first/types">Guillaume</name></GetPersonResponse></env:Body></env:Envelope> Now, if I want to test the UnknownPersonFault setting the personId to empty: ... <tns:personId></tns:personId> ... I get an HTTP Error 500 back to the client.html: STATUS: 500 <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> <title>Error 500 </title> </head> <body><h2>HTTP ERROR: 500</h2><pre>Premature end of file.</pre> <p>RequestURI=/PersonService/</p><h3>Caused by:</h3><pre>org.xml.sax.SAXParseException: Premature end of file. ... On the ServiceMix side a Fault is created as expected and should be sent to the client. But then this fault causes a XFireRuntimeException ending in a HTTP 500 error: 17:20:26,531 | ERROR | pool-flow.seda.servicemix-jsr181-thread-2 | DefaultFaultHandler | re.handler.DefaultFaultHandler 96 | Could not send fault. org.codehaus.xfire.XFireRuntimeException: Couldn't get property {http://wsdl_first.samples.servicemix.apache.org}faultInfo from bean [EMAIL PROTECTED] Nested exception is java.lang.IllegalArgumentException: object is not an instance of declaring class _Full_ Servicemix log: 17:18:34,281 | INFO | RMI TCP Connection(4)-57.57.247.229 | ServiceAssemblyLifeCycle | ework.ServiceAssemblyLifeCycle 111 | Starting service assembly: wsdl-first-sa 17:18:34,296 | INFO | RMI TCP Connection(4)-57.57.247.229 | ServiceUnitLifeCycle | framework.ServiceUnitLifeCycle 78 | Initializing service unit: wsdl-first-jsr181-su 17:18:34,296 | INFO | RMI TCP Connection(4)-57.57.247.229 | ServiceUnitLifeCycle | framework.ServiceUnitLifeCycle 78 | Initializing service unit: wsdl-first-http-su 17:18:34,296 | INFO | RMI TCP Connection(4)-57.57.247.229 | ServiceUnitLifeCycle | framework.ServiceUnitLifeCycle 97 | Starting service unit: wsdl-first-jsr181-su 17:18:34,484 | INFO | RMI TCP Connection(4)-57.57.247.229 | ServiceUnitLifeCycle | framework.ServiceUnitLifeCycle 97 | Starting service unit: wsdl-first-http-su 17:18:34,765 | INFO | RMI TCP Connection(4)-57.57.247.229 | jetty | ervicemix.http.jetty.JCLLogger 83 | jetty-6.1.5 17:18:34,828 | INFO | RMI TCP Connection(4)-57.57.247.229 | jetty | ervicemix.http.jetty.JCLLogger 83 | Started [EMAIL PROTECTED]:8192 17:20:26,515 | INFO | pool-flow.seda.servicemix-jsr181-thread-2 | DefaultFaultHandler | re.handler.DefaultFaultHandler 39 | Fault occurred! org.apache.servicemix.samples.wsdl_first.UnknownPersonFault at org.apache.servicemix.samples.wsdl_first.PersonImpl.getPerson(PersonImpl.java:34) at sun.reflect.GeneratedMethodAccessor34.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.codehaus.xfire.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:54) at org.codehaus.xfire.service.binding.ServiceInvocationHandler.sendMessage(ServiceInvocationHandler.java:322) at org.codehaus.xfire.service.binding.ServiceInvocationHandler$1.run(ServiceInvocationHandler.java:86) at org.codehaus.xfire.service.binding.ServiceInvocationHandler.execute(ServiceInvocationHandler.java:134) at org.codehaus.xfire.service.binding.ServiceInvocationHandler.invoke(ServiceInvocationHandler.java:109) at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131) at org.codehaus.xfire.transport.DefaultEndpoint.onReceive(DefaultEndpoint.java:64) at org.codehaus.xfire.transport.AbstractChannel.receive(AbstractChannel.java:38) at org.apache.servicemix.jsr181.Jsr181ExchangeProcessor.process(Jsr181ExchangeProcessor.java:114) at org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:538) at org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:490) at org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLifeCycle.java:46) at org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:610) at org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:170) at org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:167) at org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675) at java.lang.Thread.run(Thread.java:595) 17:20:26,531 | ERROR | pool-flow.seda.servicemix-jsr181-thread-2 | DefaultFaultHandler | re.handler.DefaultFaultHandler 96 | Could not send fault. org.codehaus.xfire.XFireRuntimeException: Couldn't get property {http://wsdl_first.samples.servicemix.apache.org}faultInfo from bean [EMAIL PROTECTED] Nested exception is java.lang.IllegalArgumentException: object is not an instance of declaring class java.lang.IllegalArgumentException: object is not an instance of declaring class at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.codehaus.xfire.aegis.type.basic.BeanType.readProperty(BeanType.java:442) at org.codehaus.xfire.aegis.type.basic.BeanType.writeObject(BeanType.java:377) at org.codehaus.xfire.aegis.AegisBindingProvider.writeParameter(AegisBindingProvider.java:222) at org.codehaus.xfire.service.binding.AbstractBinding.writeParameter(AbstractBinding.java:273) at org.codehaus.xfire.handler.CustomFaultHandler.handleFault(CustomFaultHandler.java:64) at org.codehaus.xfire.handler.CustomFaultHandler.invoke(CustomFaultHandler.java:51) at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131) at org.codehaus.xfire.handler.DefaultFaultHandler.sendFault(DefaultFaultHandler.java:88) at org.codehaus.xfire.handler.DefaultFaultHandler.invoke(DefaultFaultHandler.java:51) at org.codehaus.xfire.service.binding.ServiceInvocationHandler$1.run(ServiceInvocationHandler.java:99) at org.codehaus.xfire.service.binding.ServiceInvocationHandler.execute(ServiceInvocationHandler.java:134) at org.codehaus.xfire.service.binding.ServiceInvocationHandler.invoke(ServiceInvocationHandler.java:109) at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131) at org.codehaus.xfire.transport.DefaultEndpoint.onReceive(DefaultEndpoint.java:64) at org.codehaus.xfire.transport.AbstractChannel.receive(AbstractChannel.java:38) at org.apache.servicemix.jsr181.Jsr181ExchangeProcessor.process(Jsr181ExchangeProcessor.java:114) at org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:538) at org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:490) at org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLifeCycle.java:46) at org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:610) at org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:170) at org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:167) at org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675) at java.lang.Thread.run(Thread.java:595) 17:20:26,546 | WARN | btpool1-1 | jetty | ervicemix.http.jetty.JCLLogger 96 | Nested in javax.servlet.ServletException: Failed to process request: org.xml.sax.SAXParseException: Premature end of file.: org.xml.sax.SAXParseException: Premature end of file. at org.apache.xerces.parsers.DOMParser.parse(Unknown Source) at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source) at org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSourceFromStream(SourceTransformer.java:248) at org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSource(SourceTransformer.java:161) at org.apache.servicemix.soap.marshalers.SoapWriter.writeDetails(SoapWriter.java:337) at org.apache.servicemix.soap.marshalers.SoapWriter.writeSoap11Fault(SoapWriter.java:267) at org.apache.servicemix.soap.marshalers.SoapWriter.writeFault(SoapWriter.java:226) at org.apache.servicemix.soap.marshalers.SoapWriter.writeSoapEnvelope(SoapWriter.java:209) at org.apache.servicemix.soap.marshalers.SoapWriter.writeSimpleMessage(SoapWriter.java:113) at org.apache.servicemix.soap.marshalers.SoapWriter.write(SoapWriter.java:92) at org.apache.servicemix.http.processors.ConsumerProcessor.sendFault(ConsumerProcessor.java:277) at org.apache.servicemix.http.processors.ConsumerProcessor.processFault(ConsumerProcessor.java:234) at org.apache.servicemix.http.processors.ConsumerProcessor.process(ConsumerProcessor.java:201) at org.apache.servicemix.http.HttpBridgeServlet.doPost(HttpBridgeServlet.java:71) at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) at javax.servlet.http.HttpServlet.service(HttpServlet.java:690) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712) at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:211) at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139) at org.mortbay.jetty.Server.handle(Server.java:313) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:506) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:375) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:396) at org.mortbay.jetty.nio.SelectChannelConnector$RetryContinuation.run(SelectChannelConnector.java:511) at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442) 17:20:26,546 | WARN | btpool1-1 | jetty | ervicemix.http.jetty.JCLLogger 96 | /PersonService/ org.xml.sax.SAXParseException: Premature end of file. at org.apache.xerces.parsers.DOMParser.parse(Unknown Source) at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source) at org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSourceFromStream(SourceTransformer.java:248) at org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSource(SourceTransformer.java:161) at org.apache.servicemix.soap.marshalers.SoapWriter.writeDetails(SoapWriter.java:337) at org.apache.servicemix.soap.marshalers.SoapWriter.writeSoap11Fault(SoapWriter.java:267) at org.apache.servicemix.soap.marshalers.SoapWriter.writeFault(SoapWriter.java:226) at org.apache.servicemix.soap.marshalers.SoapWriter.writeSoapEnvelope(SoapWriter.java:209) at org.apache.servicemix.soap.marshalers.SoapWriter.writeSimpleMessage(SoapWriter.java:113) at org.apache.servicemix.soap.marshalers.SoapWriter.write(SoapWriter.java:92) at org.apache.servicemix.http.processors.ConsumerProcessor.sendFault(ConsumerProcessor.java:277) at org.apache.servicemix.http.processors.ConsumerProcessor.processFault(ConsumerProcessor.java:234) at org.apache.servicemix.http.processors.ConsumerProcessor.process(ConsumerProcessor.java:201) at org.apache.servicemix.http.HttpBridgeServlet.doPost(HttpBridgeServlet.java:71) at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) at javax.servlet.http.HttpServlet.service(HttpServlet.java:690) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712) at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:211) at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139) at org.mortbay.jetty.Server.handle(Server.java:313) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:506) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:375) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:396) at org.mortbay.jetty.nio.SelectChannelConnector$RetryContinuation.run(SelectChannelConnector.java:511) at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442) Any ideas why this ServiceMix example is not working? Martin
