web stats
Custom HTTP Response - Mirth Community

Go Back   Mirth Community > Mirth Connect > Development

Reply
 
Thread Tools Display Modes
  #1  
Old 09-06-2007, 01:36 PM
Jeep07 Jeep07 is offline
Mirth Newb
 
Join Date: Aug 2007
Posts: 14
Jeep07
Default Custom HTTP Response

OK I'm trying to do a custom HTTP response and read a few other threads that put me in the right direction but I can't quite get it working.

OK Channel name is "TESTER"
http listener: Port 2116
Respond from: "FW"

Destinations:
Name: "FW"
Type: File Writer
Name/Dir: Whatever you want.

Transformer on FW
Code:
//This is just for logging
logger.info("TESTER: " + ResponseFactory.getSuccessResponse('message'));
//This is where I try to do a custom http response
responseMap.put('FW', 'this is my test custom http response ' + ResponseFactory.getSuccessResponse('message'));

I also attached my channel.

I'm testing by opening the web browser and going to http://localhost:2116?Method=TEST

(Method=TEST is just so i can see how mirth handles that data)

Any help is appreciated.

I don't realy know what all responseMap.put('',''); wants. TESTER.xml (4344 bytes)
Reply With Quote
  #2  
Old 09-06-2007, 01:40 PM
chrisl chrisl is offline
Mirth Employee
 
Join Date: Aug 2006
Posts: 967
chrisl is an unknown quantity at this point
Default Re:Custom HTTP Response

In your post processor you can create a custom response. Just a quick example:
Code:
var ack = "This is a sample custom response!";
responseMap.put("FW", ResponseFactory.getSuccessResponse(ack));
When you enter the preprocessor you can get the value from FWs destination response (responseMap.get("FW").getMessage() or .getStatus()). You can then pass that back directly or you can modify the response by replacing it's value in the responseMap.
__________________
Chris Lang
Reply With Quote
  #3  
Old 09-06-2007, 01:51 PM
Jeep07 Jeep07 is offline
Mirth Newb
 
Join Date: Aug 2007
Posts: 14
Jeep07
Default Re:Custom HTTP Response

Thanks chris, that did it. I uploaded my sample channel to the inbound channels for others. It's "HTTP Sample Custom Response"

Thanks again.
Reply With Quote
  #4  
Old 09-07-2007, 01:07 PM
scottk@IntelligentSolutio scottk@IntelligentSolutio is offline
Mirth Newb
 
Join Date: Jul 2007
Posts: 15
scottk@IntelligentSolutio
Default Re:Custom HTTP Response

In a comment/response above, you mentioned a post-processor. Where is the post-processor? Did you actually mean pre-processor?
Reply With Quote
  #5  
Old 09-07-2007, 01:13 PM
Jeep07 Jeep07 is offline
Mirth Newb
 
Join Date: Aug 2007
Posts: 14
Jeep07
Default Re:Custom HTTP Response

The post processor script. Go to a channel and then go to scripts and you have a postprocessor script in the drop down.
Reply With Quote
  #6  
Old 09-07-2007, 01:57 PM
scottk@IntelligentSolutio scottk@IntelligentSolutio is offline
Mirth Newb
 
Join Date: Jul 2007
Posts: 15
scottk@IntelligentSolutio
Default Re:Custom HTTP Response

Sorry, try as I might, I can not find the post-processing script. I am using version 1.6. Am I missing something?

Post edited by: scottk@IntelligentSolutio, at: 09/07/2007 14:11
Reply With Quote
  #7  
Old 09-08-2007, 12:17 AM
chrisl chrisl is offline
Mirth Employee
 
Join Date: Aug 2006
Posts: 967
chrisl is an unknown quantity at this point
Default Re:Custom HTTP Response

Looks like you are still using a 1.5 client. Try clearing your Java cache - go to Control Panel, Java and clear the webstart cache.
__________________
Chris Lang
Reply With Quote
  #8  
Old 09-12-2007, 07:49 AM
scottk@IntelligentSolutio scottk@IntelligentSolutio is offline
Mirth Newb
 
Join Date: Jul 2007
Posts: 15
scottk@IntelligentSolutio
Default Re:Custom HTTP Response

Thanks! You are right. I had installed the 1.6, but somehow the 1.5 client was still there.
Reply With Quote
  #9  
Old 10-23-2007, 02:08 PM
andre@apexrad.com andre@apexrad.com is offline
What's HL7?
 
Join Date: Jul 2007
Posts: 3
andre@apexrad.com
Default Re:Custom HTTP Response

How can you get this to be conditional based on the sucess or failure of the destination channel ? I tried using if (responseMap.get("FW").getStatus() == "ERROR") { but no luck.

--
Reply With Quote
  #10  
Old 10-23-2007, 02:08 PM
andre@apexrad.com andre@apexrad.com is offline
What's HL7?
 
Join Date: Jul 2007
Posts: 3
andre@apexrad.com
Default Re:Custom HTTP Response

How can you get this to be conditional based on the sucess or failure of the destination channel ? I tried using if (responseMap.get("FW").getStatus() == "ERROR") { but no luck.

--
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom HTTP Response blairtaylor Support 0 03-01-2009 05:43 PM
content-type in http response msolfa Support 0 02-19-2009 02:11 AM
tcp listener not sending response yywind Support 3 09-26-2008 05:32 AM
ACK Response gcaruana Support 1 10-09-2007 01:44 PM
HL7 ADT Query response huubvandemortel Support 0 04-13-2007 02:11 AM


All times are GMT -8. The time now is 11:58 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation