web stats
Windows authenticated web service - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 01-23-2020, 08:12 AM
jerchap jerchap is offline
OBX.3 Kenobi
 
Join Date: Nov 2007
Location: British Columbia, Canada
Posts: 131
jerchap is an unknown quantity at this point
Default Windows authenticated web service

We have a ReST service, running IIS on a windows server. It requires windows authentication.

We have a Mirth 3.3.1.8057 server, with an http sender destination attempting calling the service. The destination can not authenticate to the service. It only seems to offer basic and digest not Kerberos or NTLM, which the service is expecting.

We changed to a javascript destination, and used the following code, which is capable of calling the service. Nothing in the code appears to explicitly specify to use NTML or Kerberos, so I don't actually know how this works. Any light shed on that would be great. My big question is, is it possible to get an http sender to use NTML or kerberos authentication, because in my view an http sender is much cleaner than using a javascript sender.

var data=connectorMessage.getTransformedData();
var url = new java.net.URL(URLstring);

var conn = url.openConnection();
conn.setDoOutput(true);
conn.setDoInput(true);

conn.setRequestMethod('PUT');
conn.setRequestProperty('Content-Length',0);
conn.setRequestProperty('Content-Type', 'text/plain');

var outStream = conn.getOutputStream();
var outWriter = new java.io.OutputStreamWriter(outStream);
outWriter.write(data);
outWriter.close();

//Capture Response
var respCode = conn.getResponseCode();
channelMap.put('respCode', respCode);
var responseMessage = conn.getResponseMessage();
if(respCode < 200 || respCode > 299) {
throw new java.lang.Exception('HTTP Status for ' + URLstring + ' is ' + respCode.toString() + ', ' + responseMessage);
}

var inputStream = conn.getInputStream();
var streamReader = new java.io.InputStreamReader(inputStream);
var respStream = new java.io.BufferedReader(streamReader);
var buffer = '';
var line = null;
while ((line = respStream.readLine()) != null) {
buffer = buffer + line;
}
respStream.close();
logger.info(buffer);
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 02:39 AM.


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