web stats
Mirth Community - View Single Post - Mirth Connect and Java 8
View Single Post
  #8  
Old 11-21-2014, 08:10 AM
rts rts is offline
Mirth Guru
 
Join Date: Feb 2008
Posts: 215
rts is an unknown quantity at this point
Default Mirth 3.1.1.7461 and JAVA 8

I recently installed v3.1.1.7461 and Java 8 and experienced the following error with my JS reader:
INFO 2014-11-21 10:51:34,746 [pool-3-thread-7] js-connector: PX WebSvc - ERR : JavaException: java.net.SocketException: Connection reset

Please note that I downgraded to java 7 and this connector now works as designed.


here is a snip of my reader code:

var url = new java.net.URL(destURL);

// Open connection to url
var conn = url.openConnection();

conn.setDoOutput(true);
conn.setDoInput(true);
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-length", data.length());
conn.setRequestProperty("Content-type", "text/xml");
var outStream = conn.getOutputStream();
var outWriter = new java.io.OutputStreamWriter(outStream);

outWriter.write(data);
outWriter.close();

// Get response
var respCode = conn.getResponseCode();
getResponse();
var response = new XML($('PX_WEBSVC_RESPONSE'));
var status = response['Status'].toString();

// Interrogate the status , log the error and move the message to the errored folder
if (respCode != 200 || status != 'Successful') {
..........blah
}


function getResponse()
{
var inputStream = conn.getInputStream();
var streamReader = new java.io.InputStreamReader(inputStream);
var respStream = new java.io.BufferedReader(streamReader);

//create variable to hold return data
//var buffer = new java.lang.StringBuffer();
var buffer = '';
var line = null;
while ((line = respStream.readLine()) != null) {
buffer = buffer + line;
}

channelMap.put('PX_WEBSVC_RESPONSE', buffer);

responseMap.put('PX_WEBSVC', ResponseFactory.getSentResponse(buffer))
respStream.close();

}


Thanks
Rick
Reply With Quote