web stats
Mirth Community - View Single Post - Handling namespaces in JavaScript XML constructor
View Single Post
  #1  
Old 03-05-2015, 03:41 PM
ahart ahart is offline
OBX.2 Kenobi
 
Join Date: Oct 2014
Posts: 56
ahart is on a distinguished road
Question Handling namespaces in JavaScript XML constructor

I have some javascript code in a channel scoped code template function that was running in Mirth 2.3 where I create an XMl object from a String containing XML.

e.g., var resultXml = new XML(responseMap.get('Call DIS').getMessage());

I'm converting to Mirth 3.2. Now, I'm getting an error because it's encountering some elements with a namespace prefix:

LINE NUMBER: 198
DETAILS: TypeError: The prefix "S" for element "S:Envelope" is not bound.

I've spent a few hours now fruitlessly looking for the correct way to declare the namespace.

I tried preceding this with:
var soap = new Namespace("S","http://schemas.xmlsoap.org/soap/envelope/");
default xml namespace=soap;

and also...

XML.addNamespace(soap);
XML.setNamespace(soap);

What is the correct way to do this?
Reply With Quote