Announcement

Collapse
No announcement yet.

Calling REST service in the Source step

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Calling REST service in the Source step

    Hi folks, I have a simple channel that reads XML files in a folder, transforms the data, then saves the transformed data in another folder. Pretty simple stuff.

    I now need to change the source step so that, instead of reading the files from a folder, I will be calling a REST service to get the files. When I look at the Source tab though I don't see any HTTP and/or web service readers, only listeners (which looks like it's meant to configure Mirth as a web service itself).

    What would be the best solution here? Should I change the source step to a Javascript reader and roll my own REST client, or is there another way to pull this off without any coding?

    I'm sure this has been asked before but for the life of me I can't find anything that specifically talks about REST in the source step, although there's quite a bit of info about using it in the destination step.

    I'm using Mirth 3.1.0. Thanks for any advice/pointers!

  • #2
    I just found this:

    http://www.mirthcorp.com/community/i...owse/MIRTH-517

    Which indicates that web service reader connectors are planned, but not implemented yet. There was also a bunch of links at the bottom which led to similar questions as mine with a variety of answers, some of which was quite some time ago so may no longer apply. Anyhow, it looks like my options are:

    1. Create a REST client in a JavaScript reader
    2. Call the REST service in the destination step and pass the output from that call to another channel.

    If anyone has any other ideas, tips or pointers I'd love to hear them. Thanks!

    Comment


    • #3
      Just create two channels, where the first one is a dummy JavaScript Reader used to trigger a message, and you use an HTTP Sender or Web Service Sender to make the initial call. Then you can forward the response from that destination to the downstream channel. You can even do it all in one channel, just use multiple destinations in the same chain.
      Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

      Nicholas Rupley
      Work: 949-237-6069
      Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


      - How do I foo?
      - You just bar.

      Comment


      • #4
        Originally posted by narupley View Post
        Just create two channels, where the first one is a dummy JavaScript Reader used to trigger a message, and you use an HTTP Sender or Web Service Sender to make the initial call. Then you can forward the response from that destination to the downstream channel. You can even do it all in one channel, just use multiple destinations in the same chain.
        Narupley, can you provide more insight on how to do this? I've figured out how to use an HTTP Sender to get a base64 encoded response that contains JSON data I need, but I can't figure out how to get this response data to another channel.

        Comment


        • #5
          You can push the base64 content on a channelMap variable. Then use this variable in the template section of a Channel writer destination. This will then send your base64 content to a downstream channel.
          HL7v2.7 Certified Control Specialist!

          Comment


          • #6
            Hi Regis,
            Where you every able to accomplish this? If so would you mind sharing your channel?

            Comment

            Working...
            X