Web Service Sender and Listener in Mirth


Mirth Connect Version : 2.0.1.5164

Here is a short demonstration on implementing Web Services in Mirth.
Based on this tutorial any web service can be implemented in a similar manner.
In order to reduce the complexity and make it a true demo (Yes even you can try your own! – Don’t worry you NEED NOT to write any web service here either in JAVA or .NET); I am using the default web service provided in Mirth.
 
Create two channels in Mirth:
This is organized in below sections:

1. Creating channel WS_Listener
2. Creating channel WS_Sender
3. Running the application
4. Important note

============== 1. Creating channel WS_Listener ==============
Create a new channel name as “WS_Listener”.

———— Source: ————
Source -> Connector Type -> Web Service Listener
Listener Address : “Listen on all interfaces”
Port: 8082 (You can have any port – that must be free for your Operating System)
Web Service : “Default service”
Service Name: Mirth (By Default it should appear)
WSDL URL: http://localhost:8082/services/Mirth?wsdl ( By default)
Method: String acceptMessage(String message) (By default)
Respond from: None
Basic Authentication : Leave empty as of now.

————  Destination: ————
Create a new destination.
Connector Type : Channel Writer
Channel Name : None
Template : ${message.encodedData}

Save the channel and deploy.
============== 2. Creating channel WS_Sender  ==============
Create a new channel name as “WS_Sender”.

———— Source: ————
Source -> Connector Type -> Channel Reader [You can have your own connector] – So that you can send a sample message “Hello World” from that dashboard.
From left panel select the “Edit Transformer” just to define a very simple message type otherwise by default you need to have a HL7 message to process it.
Click on “Message Template”. From drop down -> Delimited text as data type.
In box – just paste a sample text message -> just|a|test|message
In the outbound message template you can set the same.
Data Type – Delimited Text
In Box – just|a|test|message
Respond from : None

————  Destination: ————
Create a new destination.
Connector type -> Wes Service Sender [Select From drow down]
WSDL URL : http://localhost:8082/services/Mirth?wsdl
Click on “Get Operations” button. -> This should fill up several key-values automatically [Service, Port]
Authentication -> As of now select No as radio button.
Send Response to : None. [Select it from drop down; if you want to send to other channel]
Use Persistent Queues : No as radio button
Invocation Type : Two-Way as radio button
Operation : acceptMessage (This is the only operation defined under default Mirth’s web service).
Click on Generate Envelope – You can find a XML i.e SOAP Envelope
Look for the line:
    <!–Optional:–>
      <arg0>SCHOOLHOOD – Learn To Enjoy.</arg0>
Use MTOM – No as radio button
Save this channel and deploy it.
============== 3. Running the application ==============
 From the deployed dashboard, double click on “WS_Sender” app.
 From left panel select “Send Message”.
 Type in the pop up text box -> just|a|test|message
 And press the “Process Message” button.
 
 Come back to the dashboard list.
 Now double click on “WS_Listener” app.
 Check the message details. You should be able to see the string[SCHOOLHOOD – Learn To Enjoy.] passed by you in SOAP envelope under Raw Message tab.

 ============== 4. Important Note  ==============
 1. Only after deploying WS_Listener channel ; the WSDL url becomes active
 http://localhost:8082/services/Mirth?wsdl
 You can try out it on normal IE, Mozilla or any browser
 
 2. In the SOAP envelope, you can use any transformed values passed either from java script or through any processing lagic
 <arg0>SCHOOLHOOD – Learn To Enjoy.</arg0>
 this can take a shape of
 <arg0>${myVariable}</arg0>

Advertisements

11 comments on “Web Service Sender and Listener in Mirth

  1. That constantly will be amazing if you ask me the best way blog internet writers such as yourself can discover a little while with the motivation to carry on crafting excellent blogposts. Your website isterrific and something of my must read blogs. I just now wanted to thanks.

  2. Anonymous says:

    how to add authentication to the webservice?

  3. Chas says:

    I see you don’t use the potential of social websites like pinterest and facebook on your blog.

    You can get huge traffic from social sites on autopilot using one useful app,
    for more details search in google for:
    Alufi’s Social Automation

  4. Anonymous says:

    Hi, how do i listen to a response from web service in the same channel

  5. Anonymous says:

    seria mejor si hubieras puesto imagenes

  6. Hi, do You have any tutorial, step by step how to make custom web service?
    Thanks

    • schoolhood says:

      I tried to include those steps. I believe few snapshots would have served the purpose better. Yes you can customize the web service – but I will suggest if you have your own WS implementation, its simple to make a call from Mirth. Sending the request and handling the response for an external WS (not the default provided by Mirth itself) is pretty good in Mirth.
      Let me know what customization you need – admin@schoolhood.org

      • AP says:

        I want to create a channel with my source as a web service listener, I already have my own web service implemented (don’t need the Mirth default one). How can I achieve that?
        Thanks in advance

  7. Anonymous says:

    Hi,
    I need a integration HL7 using Mirth Connect Engine,
    Could you please suggest how to get start work with this, and how to make WSDL?

    Thanks

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s