Skip to content Skip to sidebar Skip to footer

Mirth Javascript Import

In postprocesor script I need call API. I am using this code: var xmlHttp = new XMLHttpRequest(); xmlHttp.open( 'GET', 'http://www.example.com/something', false ); xmlHttp.send( n

Solution 1:

XMLHttpRequest is something specific to web browsers. Mirth Connect uses a JavaScript engine called Mozilla Rhino, which is not a web browser oriented engine (because MC isn't a web browser obviously).

Rhino does however seamlessly integrate with the underlying JVM. Basically anything you can do in Java, you can also do within JavaScript. Use URLConnection instead for example:

var url = new java.net.URL('http://www.google.com');
var conn = url.openConnection();
varis = conn.getInputStream();
try {
    var result = org.apache.commons.io.IOUtils.toString(is, 'UTF-8');
} finally {
    is.close();
}

Post a Comment for "Mirth Javascript Import"