Schlagwort-Archive: IBM Doors

IBM Doors DXL: Call REST Services / REST-Services aufrufen

Problem

Von Doors aus sollen REST Services aufgerufen werden.

REST Services shall be called within a DXL Script in IBM Doors

Approach – Ansatz

Usage of OLE Automization

Solution – Lösung

pragma runLim,0
OleAutoArgs args = create
OleAutoArgs args2 = create
OleAutoObj http = oleCreateAutoObject("WinHttp.WinHttpRequest.5.1")
void sendResult(string commandId, string result) {
	clear(args)
	clear(args2)
	put(args, "POST")
	put(args, "https://my.url.de/commands/" commandId "/result")
	OleAutoArgs args2 = create
	put(args2, result)
	oleMethod(http, "open", args)
	string res = oleMethod(http, "send", args2)
	if(!null(res)){
				print "\n" stringOf(dateAndTime(today)) ": Sending data data Failed"
				print "\n" res
	}
}
Regexp lines = regexp ".*"
bool connected = true
while(connected) {
	clear(args)
	put(args, "GET")
	put(args, "https://my.url.de/nextCommand")
	oleMethod(http, "open", args)
	oleMethod(http, "send")
	int status
	oleGet(http, "status", status)
	connected = status == 200
	string response
	oleGet(http, "responseText", response)
	print "RESPONSE:" response "\n"
	lines response
	string commandId = response[0:end 0]
	string resultUrl = "https://my.urld.de/rest/connections/107030b3-0a046c8d-7c2b9836-edaa752e/commands/" commandId "/result"
	string command = "pragma runLim,0\nstring resultUrl = \"" resultUrl "\"\n" response[end 0+2:]
	sendResult(commandId, eval_(command))
}

IBM Doors DXL: Send email via Doors Client

Problem

Emails should be send via DXL script.

Prerequirements

The Doors Client should have access to a SMTP Server on it’s configured port (normally 25)

Right-click the doors database icon in the database explorer and make the following setttings:

Solution

string smtpServer = getDatabaseMailServer();
string smtpFrom = "Superman";
string smtpFrom2 = getDatabaseMailServerAccount();
string smtpTo = "bjoern.karpenstein@test.com";
string smtpSubject = "test";
string smtpMessage = "this is a test";

print "Mail Server Name: " smtpServer "\n";
print "Mail from account: " smtpFrom2 "\n\n";
bool b = sendEMailNotification(smtpFrom, smtpTo, smtpSubject, smtpMessage);

if (b) {
   print "Message sent\n";
} else {
   print "Could not send message.\n";
}