web stats
HTTP Sender body response when 4XX - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 03-23-2020, 02:34 AM
usuariousuario usuariousuario is offline
Mirth Newb
 
Join Date: Sep 2016
Location: Madrid, Spain
Posts: 12
usuariousuario is on a distinguished road
Default HTTP Sender body response when 4XX

Hello everyone, there is a third party who needs to receive hl7 messages over a HTTP endpoint. So I am using the HTTP Sender to send message. I am using Mirth 3.8.1, fedora 31 and open jdk 11 from adopt an openjdk

We are sending patient creation messages. But there are many times, the patients are duplicated.

If the patient is really new. They respond with a 201 http created code. Every thing is perfect and works ok.

But if the patient is a duplicate. They respond with a 422 http Unprocessable Entity and a human readable text in the HTTP body response.

Mirth detects 422 as an error, so it begins to queue, resend, timeouts ... all the stuff.

As 422 is not really an error, I have the following code in my response transformer

Code:
// if there is a 422 error, it is OK, I change the status to SENT
if( Packages.org.apache.commons.lang3.StringUtils.contains(${'responseStatusLine', '422') )
	responseStatus = SENT;
This does the trick, everything works great. But I am still unable to the get the response body with the explanation of the error they send.

Code:
response.getMessage(); // It gets nothing
The upper code only retrieves the response body if there is a 2XX response, not a 4XX. I have checked in postman there is one. But I am not able to get it in Mirth

To sum up, I have the following questions
  • Is there a way to configure to ignore 4XX errors, so there is no need to do the responseStatus = SENT ?
  • Is there a way to retrieve the body response when the status code is a 4XX ?

Changing the third party API/responses, or checking for duplicates before sending the message is not possible.

Thank you very much in advance. Any idea is really wellcome.
Reply With Quote
  #2  
Old 03-23-2020, 03:14 AM
usuariousuario usuariousuario is offline
Mirth Newb
 
Join Date: Sep 2016
Location: Madrid, Spain
Posts: 12
usuariousuario is on a distinguished road
Default

I have to say I am really sorry.

Code:
response.getMessage();
It gets the body response no matter the http status code. I may have messed with the logger statements.


So there is only one question left
  • Is there a way to configure to ignore 4XX errors, so there is no need to do the responseStatus = SENT ?

Thank you very much in advance.
Reply With Quote
  #3  
Old 03-23-2020, 02:32 PM
agermano agermano is offline
Mirth Guru
 
Join Date: Apr 2017
Location: Indiana, USA
Posts: 1,176
agermano is on a distinguished road
Default

https://github.com/nextgenhealthcare...cher.java#L393

It's hard coded into the connector that any status code < 400 is SENT, otherwise it's QUEUED, so I think the response transformer is your only option.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 01:05 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Mirth Corporation