ESME Blog

enterprise microsharing in a process context
October 26, 2008

Slide: Human- vs. Machine-based Interation

Author: dick - Categories: Design, Development, Vision - Tags: , ,

One of the interesting exercises when considering integration patterns for ESME is to distinguish between human and machine-based scenarios.

I wanted to share a picture that summarizes the interesting possibilities of both types.

October 3, 2008

ESME Integration: Javascript

Author: dick - Categories: Development - Tags: , ,

In preparation for our presentation at the DemoJam in Berlin, I wanted to find a way to mimic ESME functionality of applications to which I don’t have direct access. I wanted to to be able to click on a HTML page with a image (screenshot) and have an ESME message sent. I thought about it and did some digging / experimenting and finally found an easy via javascript.

The resulting code is based on the VBA code that I described in a previous blog.

To authenticate themselves, ESME users must replace “[REPLACE_TOKEN]“ with their own authorization token. Tags are currently hard-coded as well. 

<script type=”text/javascript” language=”javascript”>
   var http_request = false;
   function makePOSTRequest() {
      http_request = false;
      if (window.XMLHttpRequest) { // Mozilla, Safari,…
         http_request = new XMLHttpRequest();
         if (http_request.overrideMimeType) {
             http_request.overrideMimeType(’text/html’);
         }
      } else if (window.ActiveXObject) { // IE
         try {
            http_request = new ActiveXObject(”Msxml2.XMLHTTP”);
         } catch (e) {
            try {
               http_request = new ActiveXObject(”Microsoft.XMLHTTP”);
            } catch (e) {}
         }
      }
      if (!http_request) {
         alert(’Cannot create XMLHTTP instance’);
         return false;
      }
     
      http_request.open(”POST”, “http://api.esme.us/esme/api/login?token=[REPLACE_TOKEN]“, false);
      http_request.send(null);
      http_request.open(’POST’, “http://api.esme.us/esme/api/send_msg?message=javascript_test+AJAX&tags=Test,javascript&via=js“, false);
      http_request.send(null);
      http_request.open(’GET’, “http://api.esme.us/esme/api/logout“, false);
      http_request.send(null);

   }
  
</script>
<form name=”myform” id=”myform”>
<input type=”button” name=”button” value=”Submit”
   onclick=”javascript:makePOSTRequest();”>
</form>

Just copy this code into an empty text file, rename it “ESMEtest.html”, load the local file in your browser and you can create ESME messages.   This code could be enhanced and placed in more complex applications.

Note:  I’ve only tried it locally and with Internet Explorer. Maybe someone can test in FF to see if it works there as well.