Intercept Http Endpoint Exception [Mule ESB] - exception

I'am using Mule 3.3.0 CE and I would have a custom behaviour when an exception is thrown in an http outbound endpoint (i.e when I get a Connection Refused Exception or Connection Timeout Exception). Let's assume that I have this scenario: a SOAP Component and a Http Outbound Endpoint that realize together a cxf service client and let's assume that I can't use any exception strategy.
I would write an Interceptor which intercept the http exception (i.e Connection Refused) and in which I can write a custon behaviour (i.e send the message in a queue).
I need of an interceptor that intercept che http exception and no a SOAP Fault (that could be intercepted with a SOAPFaultInterceptor).
How can I realize this model?
Thank you all for any help

I found the solution. I used a custom interceptor ( component) just before the Http component and I extended the AbstractEnvelopeInterceptor that gives to me the possibility to work before, after and during the component is processing the message.
With this perspective, I implemented the last method. This method's sign contains a boolean value that is setted is an exception occurred. In this way I can leverage this method to handle any kind of exceptions that is related to Http Component.

Related

Circular error-handler detected at route: {} - breaking out processing Exchange: {}

I am having multiple camel routes written in Java DSL exceptions are handled using OnException.
Below are my requirements.
Fetch token from cache and make http call
If http call fails with invalid token then make a back end call to get new token and then make http call
If http call fails with specific error then needs to handle it properly.
Issue:
If http call fails with invalid token then it is making backend call to fetch the token and then calling http request using exception handling code. Now the http call failed again while calling from OnException with some other error and it is not going to OnException and giving circular error handler message.
Please help me to handle this error. Thankyou
I am using SpringBoot camel starter 3.8.0 and Java 11

I wan to send exception message from one quarkus service and another quarkus service. How do I do that?

I have two services, If any exception is thrown is one service I should be able to receive that exception is other service which is making the call to that service. In short I want to communicate the exception body from one service to another.
Currently the exception response is :
Received: 'Server response is: 500' when invoking: Rest Client method: 'XXX' regardless of whatever the exception message is thrown.
I want the exception message message to be communicated to the calling services.
Solution but not conventional : The Error message I am currently sending throw headers, The exception body is not picked.
From your service1 you send Response with any http status you want. At your service2 to while writing client you need to catch WebApplicationException to know what status returned by service1 client.
[Optional]
You can use org.eclipse.microprofile.rest.client.ext.ResponseExceptionMapper to map http response status to your custom exceptions at your service2

BizTalk - Why does a suspended message appear in the console for a handled exception?

Here is an image of a common structure we have in a few of our BizTalk orchestrations:
So when we GET information from an API and the account doesn't exist, we terminate the orchestration. This works fine and I can see the orchestration doing this and terminating when it should, but what I don't understand is why do I see the suspended message from the GET in the console? Since the exception handling works, shouldn't this stop an error showing in the console?
As a way around this, I've considered using a pipeline component to check the response message, and if it contains what would be ignored, just return null in place of the message. Would this have the desired effect? I'm more interested as to why I see the suspended messages in the console.
Yes, this is a known issue with the WCF-WebHttp adapter, that has to do with the fact that it throws it back as a SOAP formatted error, but without setting the MessageType context property (see my blog post and look for Bug: BizTalk WCF-WebHttp adapter does not set the message type on error). So although the exception is thrown back at the Orchestration and can be handled there, the message is not as BizTalk does not know what type it is and it suspends.
A workaround we use is
To set Enable Routing for failed messages on the send port
To have a send port that subscribes to all the response messages from that send port using the BTS.SPName = xxxx filter, and send port sends it to a custom NULL adapter (throw the message away), and yes, your Orchestration will still get the good response as well as the exceptions.
Update the send port that handles routing errors from other send ports that we do want to go to our exception handing to exclude those send ports which we are handling via an Orchestration.

AFNetworking 2.0 - AFSecurityPolicy subclass not working

I am trying to perform some SSL certificate checking that isn't done in the default AFSecurityPolicy (even with various flags set).
I have subclassed AFSecurityPolicy and am returning NO from evaluateServerTrust:forDomain: for testing purposes. I have verified that my class is being called.
AFNetworking's NSURLConnectionDelegate is in the class AFURLConnectionOperation. In the delegate callback, after I return NO, it is calling
[[challenge sender] cancelAuthenticationChallenge:challenge];
The HTTP request completes and I am getting the expected data from the server.
I would expect the HTTP request to not be made after the authentication challenge is cancelled.

WSO2 ESB catch transport exceptions (MessageBuilder)

When I read a message with a WSO2 ESB Proxy, I need to define a specific datatype and this is then applying a certain MessageBuilder (defined in the axis2.xml).
But when the MessageBuilder fails (i.e. I try to read a text file with the XMLBuilder) I get an exception in the console, but my "faultSequence" is not called. But I need to do a certain Error Handling in case of any read problem.
How can I catch Exceptions from the Transport Layer (MessageBuilder) in a Proxy?
As far as i understand , your requirement is to catch an Error in the Transport layer and handle that in the Application level (i.e : Mediation level). which means the layer above.
But i think it violates layered architecture of the messaging framework. You should catch the Exception at the Message Builder itself and throw an Axis Fault so that underlying synapse transport layer (in this case Axis2) will handle that error. (It will send a fault to the client.)
If we look at the TCP protocol stack that is the practice which is commonly used.
If you really want to filter this errors at mediation level. Catch that Error in the Message Builder and add a Message Context property or custom message and pass it as a successful message. And Do a filter in mediation level and handle.
But again that is ugly.
:)
--Charith
Have you defined onError attribute in your configuration?
<sequence name="main" onError="myFaultSequence">
You can have more information in this sample.