Archive for category javascript
Unable to apply Javascript XSL Transform over HTTPS
Posted by Stephen Downey in cache-control, http, https, java, javascript, xml, xsl on January 28, 2008
I came across this issue a while a go and couldn’t really find much information on it at the time so thought that I would post about it just in case anyone has a similar issue.
We had the following code that loads an XML document and then applies a XSL transform against the XML document. The code looks a bit like following:
(This is the IE Specific version)
xmlDoc = new ActiveXObject(‘Msxml2.DOMDocument.3.0’);
xmlDoc.loadXML(XMLString);
xslDoc = new ActiveXObject(‘Msxml2.DOMDocument.3.0’);
xslDoc.load(xslFile);
output = xmlDoc.transformNode(xslDoc);
We would normally run this over HTTP and it always applied the transform and generated our output as you would expect. When we ran the same code over HTTPS the transform would never work.
After a lot of investigation it turned out that the issue was being caused due to a cache setting in the response header.
We were setting the Cache-Control parameter in the Response header to
‘private,no-cache,no-store’.
It seems that not allowing the XSL form to be cached was preventing the ActiveObject from loading it for the transform. By removing Cache-control parameter from the response header it worked fine every time.
Hope this can save someone with the same issue a bit of time.
AJAX process definition on Client Side
Posted by Stephen Downey in AJAX, article, J-SOFA, java, javascript on December 19, 2006
I came across an interesting article by Masayuki Otoshi via Java World that discusses how to execute process definitions on the client side rather than the server side. This can come into play when making AJAX calls. As AJAX is Asynchronous, it is not possible to predict the order that your callback methods will be called in. Masayuki uses J-SOFA (Java/JavaScript Services Orchestration for Actions) to overcome this.
I haven't come across J-SOFA before but it looks like it might be worth looking at for situations where the order of callback methods is important.