web stats
how to "run" the wiki tutorial "Creating a custom REST Service in Mirth 3.0.x" ? - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 02-07-2020, 12:35 PM
gomezmsebastian gomezmsebastian is offline
OBX.1 Kenobi
 
Join Date: Feb 2013
Posts: 38
gomezmsebastian is on a distinguished road
Default how to "run" the wiki tutorial "Creating a custom REST Service in Mirth 3.0.x" ?

Hello
you guys probably has seen the tutorial in the mirth wiki:

http://www.mirthcorp.com/community/w...in+Mirth+3.0.x

I'm having trouble makin it work: I have created the channel with the source and destination as instructed, but I don't know how to "run" it

how should I consume the web service? I tried SoapUI, but I can't figure out how.

and what answer should I expect?

thanks

PD: I'm using Mirth 3.4.2 (64 bits) on a Windows 8.1 machine
Reply With Quote
  #2  
Old 02-12-2020, 07:03 AM
obsessio obsessio is offline
Mirth Guru
 
Join Date: Mar 2015
Location: Turkey
Posts: 177
obsessio is on a distinguished road
Default

Use the HTTP URL where you defined at HTTP Listener Settings.
Reply With Quote
  #3  
Old 02-12-2020, 07:21 AM
gomezmsebastian gomezmsebastian is offline
OBX.1 Kenobi
 
Join Date: Feb 2013
Posts: 38
gomezmsebastian is on a distinguished road
Default

I did, I mean, I open a browser and type http://localhost:8081/miservice/
and in the dashboard I got
Quote:
[2020-02-12 10:19:58,111] ERROR (com.mirth.connect.connectors.js.JavaScriptDispatc her:193): Error evaluating JavaScript Writer (JavaScript Writer "Destination 1" on channel 74dd1ce8-e263-403b-94c3-1b188c583967).
com.mirth.connect.server.MirthJavascriptTransforme rException: CHANNEL:
WS_testCONNECTOR:
Destination 1SCRIPT SOURCE:
JavaScript WriterSOURCE CODE:
82: // the "path info" of the request, so it will start with '/miservicio'.83: var rest = msg['RequestContextPath'];84: var myServicePrefix = '/miservicio';85: var minimumURLParameterCount = 4; // This is the minimum you require to do your work86: var maximumExpectedURLParameterCount = 5; // however many you expect to get87: var params = rest.substring(myServicePrefix.length).split('/', maximumExpectedURLParameterCount);88: if(params.length < minimumURLParameterCount)89: return Packages.com.mirth.connect.server.userutil.Respons eFactory.getErrorResponse('Too few parameters in request');90: var mrn = params[1]; // params[0] will be an empty string91: LINE NUMBER:
87DETAILS:
TypeError: Cannot find function substring in object .
Reply With Quote
  #4  
Old 02-13-2020, 01:17 AM
obsessio obsessio is offline
Mirth Guru
 
Join Date: Mar 2015
Location: Turkey
Posts: 177
obsessio is on a distinguished road
Default

Use toString method before substring method.

PHP Code:
var params rest.toString().substring(myServicePrefix.length).split('/'maximumExpectedURLParameterCount); 
Reply With Quote
  #5  
Old 02-13-2020, 05:53 AM
gomezmsebastian gomezmsebastian is offline
OBX.1 Kenobi
 
Join Date: Feb 2013
Posts: 38
gomezmsebastian is on a distinguished road
Default

thanks, now the error is gone.

but now I'm getting "Too few parameters in request"...

I've tried http://localhost:8081/miservicio/foo/bar/3/4/5

=(
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


All times are GMT -8. The time now is 03:14 PM.


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