Question

I have a mirth instance (version 3.0.1) sending out using a POST method to a web api restfull service.

[POST("MessagesHl7/OML_O21")]   public HttpResponseMessage
 PostOmlo21([FromBody] sting receivedmessage)   {..}

The problem is that the message hl7 that is sent to the service in a outbound message is cut in the first characters. For example, in the message:

MSH|^~\&|CPSI^1.3.6.1.4.1.27248.1.17^ ISO|CGH|...

in the receivedmessage variable the text MSH|^~\ is received only. How can I do in order that the message is not cut?

In the http channel, the configuration is:POST, not query parameters, in

headers content-type application/x-www-form-urlencoded,

Content-Type value application/xml,

and the value that send is =${message.encodedData}.

Was it helpful?

Solution

Change your action method to not use binding and just read the request body as string.

[POST("MessagesHl7/OML_O21")]
public Task<HttpResponseMessage> PostOmlo21()
{
    string receivedMessage = await Request.Content.ReadAsStringAsync();
}

OTHER TIPS

I would suggest to use Base64 encoding for the HL7 piped message since there are many special characters within the message which can be interpreted in the wrong way during parsing. Especially during the parsing of xml.

Of course you have to decode the HL7 message on Server side. But i think Mirth gives you all functionallity to do that.

I don't know which class to use in C#/ASP in Java appropriate classes and frameworks for encoding an decoding Base64 exist. I believe the same is true for C# and ASP.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top