Neuron ESB User Network

The Service Bus for the Connected Business

Hi everyone,

I am still a bit confused about the use of the service policy for the REST services.

It is possible to configure http status code to be included/excluded from the exception, and I thought this was related to the property "Throw exception on Fault" available on the "ServiceEndpoint process step".

I would like to control the behavior of a service replacing the following custom code, is it possible?

if (context.Data.Header.FaultType != FaultType.None) {

switch (context.Data.Http.StatusCode) {

case System.Net.HttpStatusCode.InternalServerError:
case System.Net.HttpStatusCode.BadRequest:
throw new ApplicationException(string.Format("Unexpected error during call, ther server returned a {0} HTTP code.", context.Data.Http.StatusCode));

case System.Net.HttpStatusCode.NotFound:
context.Data.Text = "<Subscriptions></Subscriptions>";
break;
}
}

I created a policy excluding 404 code, as in img (2) and applied the policy to the endpoint. With the "Throw exception on Fault" = true, it's still throwing an exception as happens if I do not change anything (1). I would expected the service to continue the normal flow, am I missing something?

Thank you very much

Fabrizio

Views: 291

Attachments:

Reply to This

Replies to This Discussion

Sorry guys if I insist but I would like to understand how this works...

I have a REST Endpoint configured with a specific Service policy. The policy exclude the 404 HTTP code as an exception.
What I would expect is that when invoked, if it returns a 500 code, then an exception is thrown and the process aborts, while if it returns a 404 nothing happens and the process continues.

I can't get it to work.. this is the expcetion that I get when the service replies with 404 and the process aborts.

Aborted: The service connector reported an error: There was no endpoint listening at http://localhost:8080/RESTMockService that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. : Neuron.Pipelines.PipelineException: The service connector reported an error: There was no endpoint listening at http://localhost:8080/RESTMockService that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. ---> System.ServiceModel.EndpointNotFoundException: There was no endpoint listening at http://localhost:8080/RESTMockService that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. ---> System.Net.WebException: The remote server returned an error: (404) Not Found.
at System.Net.HttpWebRequest.GetResponse()

What am I missing?

I would like to avoid writing custom code to manage this simple scenario, I would like to consider a 4040 a valid answer for thi particular service.. shouldn't the policy solve it?

RSS

Neuron ESB Product Support Forums and Communities

Latest Activity

Anupama Nair posted a discussion

Marketo Adapter Invalid Token

Hi,We are using the Marketo adapter to push account updates to Marketo. It works well for some time then starts failing with Invalid Token unless restarted. Is there a configuration that can be done so it can auto refresh the token when required?Thanks!See More
Nov 6, 2023
Sayantini Basak posted a discussion

Maximum payload size(REST API) for requests interfacing to NeuronESB

I am new to Neuron ESB and in our current scenario,We need to process batch transactions comprising of ~1000 records and send them to Neuron ESB for further processing. I would like to understand what is the maximum size of payload that can be transferred using REST interface to Neuron ESB.See More
Jul 22, 2022
Profile IconRobert E Dunie and Sayantini Basak joined Neuron ESB User Network
Apr 28, 2022
Profile IconDayanand, Frederic C, Steffen Greve-Oksfeldt and 1 more joined Neuron ESB User Network
Mar 16, 2022
Profile IconCam Vong and Mitja Luznar joined Neuron ESB User Network
Jan 27, 2022
Profile IconWill Hitzges, Chad Parsons, michael larsen and 4 more joined Neuron ESB User Network
Jun 11, 2021
Anupama Nair posted a discussion

ODBC stored proc polling with temporary tables

We have set up an ODBC adapter to poll a stored proc.We found that if the stored proc has a temporary table defined the rows returned are always 0.Any idea why this would be and what we can do to get around it?See More
Dec 14, 2020
Prasanth Kharade is now a member of Neuron ESB User Network
Dec 30, 2019

Badge

Loading…

© 2024   Created by Neuron Admin.   Powered by

Badges  |  Report an Issue  |  Terms of Service