You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Castyn <er...@gmail.com> on 2012/03/20 20:39:42 UTC

CXF and Overriding SOAP Faults

Greetings,

I was wondering if it was possible to overwrite a SOAP fault generated by a
CXF consumer.  Currently I have a route setup that starts from a CXF
consumer and then sends to a CXF producer.  I have schema validation turned
on in the consumer, so it seems that when an invalid message comes through,
the consumer generates a SOAP fault and passes it back without an ability to
hold it on the exchange.

Is there a way to allow the exchange to get a hold of the SOAP fault before
it is sent back?

The route is simply:

<route id="route1">
	<from uri="cxf:bean:theCXFConsumer" />
	<log message="Incoming CXF message, routing to producer" />
	<to uri="cxf:bean:theCXFProducer"/>
</route>

Since with schema validation turned on the route never gets to the log
message part I can't simply inject a processor where I could manually
control the contents of the SOAP fault, thus I am unsure if it is possible
to do this.  Anyone have an idea of how this could be done?

CXF consumer defined as:

	<cxf:cxfEndpoint
	        id="theCXFConsumer"
	        address="http://0.0.0.0:9191/TheWebService"
	        wsdlURL="wsdl/test.wsdl"
	        serviceClass="com.ihg.webservice.WebService">
	        <cxf:properties>
	            <entry key="schema-validation-enabled" value="true" />
	        </cxf:properties>
	</cxf:cxfEndpoint>
 

--
View this message in context: http://camel.465427.n5.nabble.com/CXF-and-Overriding-SOAP-Faults-tp5581028p5581028.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: CXF and Overriding SOAP Faults

Posted by Willem Jiang <wi...@gmail.com>.
It make sensen.
You can add your customer interceptor to wrap the exception as you want.

I don't think there are any example you can take a look.
But it could be greate if you share your result with us. I think we can 
add a FAQ entry for it.

On Wed Mar 21 11:30:55 2012, Castyn wrote:
> The reason I need the ability to modify the SOAP faults is because the SOAP
> fault messages will be directly viewed by a user from a client with an
> external app, so rather than display something potentially cryptic we are
> going to spend some time wrapping the errors in custom error codes with
> human friendly messages.
>
> I'll look into the FaultOutInterceptors, is there anything special I need to
> be aware of, or any existing examples in test cases anywhere of this
> behavior?
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/CXF-and-Overriding-SOAP-Faults-tp5581028p5581850.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
         http://jnn.javaeye.com (Chinese)
Twitter: willemjiang 
Weibo: willemjiang 


Re: CXF and Overriding SOAP Faults

Posted by Castyn <er...@gmail.com>.
The reason I need the ability to modify the SOAP faults is because the SOAP
fault messages will be directly viewed by a user from a client with an
external app, so rather than display something potentially cryptic we are
going to spend some time wrapping the errors in custom error codes with
human friendly messages.

I'll look into the FaultOutInterceptors, is there anything special I need to
be aware of, or any existing examples in test cases anywhere of this
behavior?

--
View this message in context: http://camel.465427.n5.nabble.com/CXF-and-Overriding-SOAP-Faults-tp5581028p5581850.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: CXF and Overriding SOAP Faults

Posted by Willem Jiang <wi...@gmail.com>.
Hi,

The validation is done by the CXF data binding interceptor. Camel 
doesn't know anything about it.
I don't know why you need handle the SOAP fault yourself.  
If you still need to do it yourself, you may need to setup customer 
FaultOutInterceptors yourself on the CXF enpdoint.

Willem

On Wed Mar 21 03:39:42 2012, Castyn wrote:
> Greetings,
>
> I was wondering if it was possible to overwrite a SOAP fault generated by a
> CXF consumer.  Currently I have a route setup that starts from a CXF
> consumer and then sends to a CXF producer.  I have schema validation turned
> on in the consumer, so it seems that when an invalid message comes through,
> the consumer generates a SOAP fault and passes it back without an ability to
> hold it on the exchange.
>
> Is there a way to allow the exchange to get a hold of the SOAP fault before
> it is sent back?
>
> The route is simply:
>
> <route id="route1">
> 	<from uri="cxf:bean:theCXFConsumer" />
> 	<log message="Incoming CXF message, routing to producer" />
> 	<to uri="cxf:bean:theCXFProducer"/>
> </route>
>
> Since with schema validation turned on the route never gets to the log
> message part I can't simply inject a processor where I could manually
> control the contents of the SOAP fault, thus I am unsure if it is possible
> to do this.  Anyone have an idea of how this could be done?
>
> CXF consumer defined as:
>
> 	<cxf:cxfEndpoint
> 	        id="theCXFConsumer"
> 	        address="http://0.0.0.0:9191/TheWebService"
> 	        wsdlURL="wsdl/test.wsdl"
> 	        serviceClass="com.ihg.webservice.WebService">
> 	<cxf:properties>
> 	<entry key="schema-validation-enabled" value="true" />
> 	</cxf:properties>
> 	</cxf:cxfEndpoint>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/CXF-and-Overriding-SOAP-Faults-tp5581028p5581028.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
         http://jnn.javaeye.com (Chinese)
Twitter: willemjiang 
Weibo: willemjiang