Repository navigation
Dbe/fix soap fault marks endpoint down #74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,7 @@ | |
| using System.Collections.Concurrent; | ||
| using System.Net; | ||
| using System.Net.Http; | ||
| using System.ServiceModel; | ||
| using System.Xml; | ||
| using static Dynamicweb.Ecommerce.DynamicwebLiveIntegration.Notifications.Communication; | ||
|
|
||
|
|
@@ -308,6 +309,12 @@ private static void HandleException(ConnectorBase connector, Settings settings, | |
| { | ||
| httpStatusCode = HttpStatusCode.OK; | ||
| bool skipError = false; | ||
| //Do not mark the connection as failed on SOAP faults (the service responded, but the ERP returned a business error) | ||
| if (IsSoapFault(ex)) | ||
| { | ||
| skipError = true; | ||
| retry = false; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This unconditionally disables retry for any SOAP fault, including transient business-rule faults from NAV/BC (e.g. record locking) — the PR's own motivating case.
Before this PR, a transient fault here got up to 3 retries; after it, one attempt and done — the request now fails outright instead of clearing on retry. Could this preserve the existing retry behavior and only suppress the endpoint-down marking ( |
||
| } | ||
| //Do not ping Endpoints with Internal Server Error 500 (that means that the request was received but generating response failed) | ||
| if (ex?.InnerException is not null) | ||
| { | ||
|
|
@@ -355,6 +362,18 @@ private static void HandleException(ConnectorBase connector, Settings settings, | |
| } | ||
| } | ||
|
|
||
| private static bool IsSoapFault(Exception ex) | ||
| { | ||
| for (var current = ex; current is not null; current = current.InnerException) | ||
| { | ||
| if (current is FaultException) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
For a plain
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Separate point on the same check: it treats every |
||
| { | ||
| return true; | ||
| } | ||
| } | ||
| return false; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Retrieves a PDF document as a Base64-encoded string based on the specified request and submission type. | ||
| /// </summary> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unlike the other three checks further down in this method, the new SOAP-fault branch never assigns
httpStatusCode— it's left at theHttpStatusCode.OKset here. So a suppressed SOAP-fault failure comes back from e.g.GetProductsInfoasresult == nullwithhttpStatusCode == HttpStatusCode.OK, indistinguishable by status code alone from an actual success for callers that branch onhttpStatusCode(e.g. the 500-based 30s request suppression inFetchProductInfosInternal-style callers).