Announcement

Collapse
No announcement yet.

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

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

  • 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

  • #2
    Use the HTTP URL where you defined at HTTP Listener Settings.

    Comment


    • #3
      I did, I mean, I open a browser and type http://localhost:8081/miservice/
      and in the dashboard I got
      [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 .

      Comment


      • #4
        Use toString method before substring method.

        PHP Code:
        var params rest.toString().substring(myServicePrefix.length).split('/'maximumExpectedURLParameterCount); 

        Comment


        • #5
          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

          =(

          Comment

          Working...
          X