![]() |
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? |
for soap name space:
var soapenv = new Namespace('http://schemas.xmlsoap.org/soap/envelope/'); set default name space as default xml namespace = '<URL>' you can get response from destination as var resp = responseMap.get('destination 1 name').getMessage(); var respXML = new XML(resp); to check an element var element = respXML.soapenv::Body:elementname.elementname.toSt ring() |
I don't see how that's much different than what I've tried. Am I missing something?
|
Quote:
|
In a channel I have a destination that makes a call out to some Java code. That java code returns a response which I place into a channelMap variable. In a subsequent destination I then pass this response into a code template function with channel scope. That's where I am encountering the problem. So, I don't see how the message templates would come into play. (I did see the other forum postings regarding this...) This worked in 2.x, started having problems in 3.2.
|
Stuck on TypeError: The prefix "soap" for element "soap:Envelope" is not bound.
Quote:
Thank you |
All times are GMT -8. The time now is 08:51 AM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation