Post to OpenHIM

33 views
Skip to first unread message

Gilbert Agbodamakou

unread,
Jul 22, 2019, 10:22:37 AM7/22/19
to Interoperability Layer (OpenHIE)
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

ben traore

unread,
Jul 22, 2019, 10:27:56 AM7/22/19
to Gilbert Agbodamakou, Interoperability Layer (OpenHIE)
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)



--
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-interoperabil...@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.

Gilbert Agbodamakou

unread,
Jul 22, 2019, 10:54:48 AM7/22/19
to Interoperability Layer (OpenHIE)
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.

Gilbert Agbodamakou

unread,
Jul 22, 2019, 12:34:56 PM7/22/19
to Interoperability Layer (OpenHIE)

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.

ben traore

unread,
Jul 22, 2019, 12:47:52 PM7/22/19
to Gilbert Agbodamakou, Interoperability Layer (OpenHIE)
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

To unsubscribe from this group and stop receiving emails from it, send an email to openhie-interoperabil...@googlegroups.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-interoperabil...@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.

Gilbert Agbodamakou

unread,
Jul 22, 2019, 12:59:18 PM7/22/19
to Interoperability Layer (OpenHIE)
Sure,
i'm checking that
Thank you
To unsubscribe from this group and stop receiving emails from it, send an email to openhie-interoperability-layer+unsubscribe@googlegroups.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.

Gilbert Agbodamakou

unread,
Jul 22, 2019, 2:46:47 PM7/22/19
to Interoperability Layer (OpenHIE)
Hi Ben,
I found the problem,
it was the body type.
Your help was precious, thank you very much.
Gilbert

Martin Brocker

unread,
Jul 23, 2019, 4:14:36 AM7/23/19
to Gilbert Agbodamakou, Interoperability Layer (OpenHIE)
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. 

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....@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.



--
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-interoperabil...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openhie-interoperability-layer/febbd234-77ba-4fd9-8b50-944aac96728b%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages