Post to OpenHIM

Hi everyone,
I’m facing an issue sending a POST to a nodejs mediator i created.
The fact is req.body is all the time undefined.
I must be missing something.
Do you have an idea?
Have a nice day
Gilbert

Hi Gilbert,

try with the code in the index.js file here
https://gitlab.com/traore-benidrissa/openhim-mediator-scaffold

···

*Cordialement **| Kind Regards *

Ben Idrissa TRAORE, PMP**| Project Manager | Informatics Expert
Tél. +226 70 22 06 89 | +226 76 48 64 06
|traore.benidrissa@gmail.com | bitraore@prj.wahooas.org
Linkedin
**| Microsoft Expert transcript (ID:985381 Code:benidrissa)

Thank you Ben,
I will give you a feedback.
kind regard

···

On Monday, July 22, 2019 at 3:27:56 PM UTC+1, ben traore wrote:

Hi Gilbert,

try with the code in the index.js file here
https://gitlab.com/traore-benidrissa/openhim-mediator-scaffold
*Cordialement **| Kind Regards *

Ben Idrissa TRAORE, PMP**| Project Manager **| Informatics Expert
Tél. +226 70 22 06 89 | +226 76 48 64 06

traore.b...@gmail.com | bitr...@prj.wahooas.org
Linkedin****| Microsoft Expert transcript (ID:985381 Code:benidrissa)

On Mon, Jul 22, 2019 at 2:22 PM Gilbert Agbodamakou agboda...@gmail.com wrote:

Hi everyone,
I’m facing an issue sending a POST to a nodejs mediator i created.
The fact is req.body is all the time undefined.
I must be missing something.
Do you have an idea?
Have a nice day
Gilbert

You received this message because you are subscribed to the Google Groups “Interoperability Layer (OpenHIE)” group.

To unsubscribe from this group and stop receiving emails from it, send an email to openhie-interoperability-layer+unsubscribe@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/openhie-interoperability-layer/f350a3b5-dbea-47d5-b7e0-62a4cce099f7%40googlegroups.com.

Hi Ben,
The code you sent source shows how to post data from mediator, This is interesting.
But it doesn’t solve the problem.

I have a system A that send POST data to my mediator via its openHim channel.
I can see the data on the openHim console transaction log.
But i don’t have this posted data when i’m in the mediator.

see:

app.all(‘*’, (req, res) => {

···

// These variables contains informations

****req.method, req.url and req

//but this variable always contains undefined

****req.body

});

Thank you in advance for your help.

Gilbert

On Monday, July 22, 2019 at 3:27:56 PM UTC+1, ben traore wrote:

Hi Gilbert,

try with the code in the index.js file here
https://gitlab.com/traore-benidrissa/openhim-mediator-scaffold
*Cordialement **| Kind Regards *

Ben Idrissa TRAORE, PMP**| Project Manager **| Informatics Expert
Tél. +226 70 22 06 89 | +226 76 48 64 06

traore.b...@gmail.com | bitr...@prj.wahooas.org
Linkedin****| Microsoft Expert transcript (ID:985381 Code:benidrissa)

On Mon, Jul 22, 2019 at 2:22 PM Gilbert Agbodamakou agboda...@gmail.com wrote:

Hi everyone,
I’m facing an issue sending a POST to a nodejs mediator i created.
The fact is req.body is all the time undefined.
I must be missing something.
Do you have an idea?
Have a nice day
Gilbert

You received this message because you are subscribed to the Google Groups “Interoperability Layer (OpenHIE)” group.

To unsubscribe from this group and stop receiving emails from it, send an email to openhie-interoperability-layer+unsubscribe@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/openhie-interoperability-layer/f350a3b5-dbea-47d5-b7e0-62a4cce099f7%40googlegroups.com.

Okay. Sorry, I didn’t understand you well then.

Normally it’s fine in req.body. Maybe you need to get into JSON.

So can you log the object or req or try to call your mediator directly without going through the channel to test?

Cordialement | Regards
Ben Idrissa TRAORE, PMP
Tel. +226 76486406
Tel. +226 70220689

···

Sent from my phone

On Mon, Jul 22, 2019, 16:34 Gilbert Agbodamakou agbodamakoug@gmail.com wrote:

Hi Ben,
The code you sent source shows how to post data from mediator, This is interesting.
But it doesn’t solve the problem.

I have a system A that send POST data to my mediator via its openHim channel.
I can see the data on the openHim console transaction log.
But i don’t have this posted data when i’m in the mediator.

see:

app.all(‘*’, (req, res) => {


// These variables contains informations

****req.method, req.url and req

//but this variable always contains undefined

****req.body

});

Thank you in advance for your help.

Gilbert

On Monday, July 22, 2019 at 3:27:56 PM UTC+1, ben traore wrote:

Hi Gilbert,

try with the code in the index.js file here
https://gitlab.com/traore-benidrissa/openhim-mediator-scaffold
*Cordialement **| Kind Regards *

Ben Idrissa TRAORE, PMP**| Project Manager **| Informatics Expert
Tél. +226 70 22 06 89 | +226 76 48 64 06

traore.b...@gmail.com | bitr...@prj.wahooas.org
Linkedin****| Microsoft Expert transcript (ID:985381 Code:benidrissa)

On Mon, Jul 22, 2019 at 2:22 PM Gilbert Agbodamakou agboda...@gmail.com wrote:

Hi everyone,
I’m facing an issue sending a POST to a nodejs mediator i created.
The fact is req.body is all the time undefined.
I must be missing something.
Do you have an idea?
Have a nice day
Gilbert

You received this message because you are subscribed to the Google Groups “Interoperability Layer (OpenHIE)” group.

To unsubscribe from this group and stop receiving emails from it, send an email to openhie-interoperability-layer+unsubscribe@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/openhie-interoperability-layer/f350a3b5-dbea-47d5-b7e0-62a4cce099f7%40googlegroups.com.

You received this message because you are subscribed to the Google Groups “Interoperability Layer (OpenHIE)” group.

To unsubscribe from this group and stop receiving emails from it, send an email to openhie-interoperability-layer+unsubscribe@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/openhie-interoperability-layer/f3d27885-a17f-431c-8f4c-d4695e8201a6%40googlegroups.com.

Sure,
i’m checking that
Thank you

···

On Monday, July 22, 2019 at 5:47:52 PM UTC+1, ben traore wrote:

Okay. Sorry, I didn’t understand you well then.

Normally it’s fine in req.body. Maybe you need to get into JSON.

So can you log the object or req or try to call your mediator directly without going through the channel to test?

Cordialement | Regards
Ben Idrissa TRAORE, PMP
Tel. +226 76486406
Tel. +226 70220689

Sent from my phone

On Mon, Jul 22, 2019, 16:34 Gilbert Agbodamakou agboda...@gmail.com wrote:

Hi Ben,
The code you sent source shows how to post data from mediator, This is interesting.
But it doesn’t solve the problem.

I have a system A that send POST data to my mediator via its openHim channel.
I can see the data on the openHim console transaction log.
But i don’t have this posted data when i’m in the mediator.

see:

app.all(‘*’, (req, res) => {


// These variables contains informations

****req.method, req.url and req

//but this variable always contains undefined

****req.body

});

Thank you in advance for your help.

Gilbert

On Monday, July 22, 2019 at 3:27:56 PM UTC+1, ben traore wrote:

Hi Gilbert,

try with the code in the index.js file here
https://gitlab.com/traore-benidrissa/openhim-mediator-scaffold
*Cordialement **| Kind Regards *

Ben Idrissa TRAORE, PMP**| Project Manager **| Informatics Expert
Tél. +226 70 22 06 89 | +226 76 48 64 06

traore.b...@gmail.com | bitr...@prj.wahooas.org
Linkedin****| Microsoft Expert transcript (ID:985381 Code:benidrissa)

On Mon, Jul 22, 2019 at 2:22 PM Gilbert Agbodamakou agboda...@gmail.com wrote:

Hi everyone,
I’m facing an issue sending a POST to a nodejs mediator i created.
The fact is req.body is all the time undefined.
I must be missing something.
Do you have an idea?
Have a nice day
Gilbert

You received this message because you are subscribed to the Google Groups “Interoperability Layer (OpenHIE)” group.

To unsubscribe from this group and stop receiving emails from it, send an email to openhie-interoperability-layer+unsubscribe@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/openhie-interoperability-layer/f350a3b5-dbea-47d5-b7e0-62a4cce099f7%40googlegroups.com.

You received this message because you are subscribed to the Google Groups “Interoperability Layer (OpenHIE)” group.

To unsubscribe from this group and stop receiving emails from it, send an email to openhie-interoperability-layer+unsubscribe@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/openhie-interoperability-layer/f3d27885-a17f-431c-8f4c-d4695e8201a6%40googlegroups.com.

Hi Ben,
I found the problem,
it was the body type.
Your help was precious, thank you very much.
Gilbert

Hi Gilbert

Glad that Ben managed to help you in the right direction to solve your issue. What it could also have been was to include a body parser within your application to receive the req.body successfully.

A link to the explain the issue: https://stackoverflow.com/a/43626891/11032197

We have been working on some tutorials to help with Mediator development which can be found here:
https://github.com/jembi/openhim-mediator-tutorial

We have also been adding some videos of these tutorials to make it easier to follow along.

https://www.youtube.com/channel/UCz3UpAGDJbKG7KkorgMGfEA

We unfortunately dont yet have a tutorial on receiving POST payloads, but following the above linked example should lead you in the right direction

Regards,

···


**Martin Brocker **
Team Lead
martin.brocker@jembi.org
Tel: +27 21 701 0939
Jembi Health Systems | Cape Town
www.jembi.org
This e-mail contains proprietary and confidential information some or all of which may be legally privileged. It is for the intended recipient only. If an addressing or transmission error has misdirected this e-mail, please notify the author by replying to this e-mail and then deleting same. If you are not the intended recipient you must not use, disclose, distribute, copy, print or rely on this e-mail. Jembi Health Systems NPO, its subsidiaries and associated companies is not liable for the security of information sent by e-mail and accepts no liability of whatsoever nature for any loss, damage or expense resulting, directly or indirectly, from the access of this e-mail or any attachments hereto.