web stats
Escape characters generating error in OBX - Page 3 - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #21  
Old 12-12-2019, 06:15 AM
Ozz Ozz is offline
OBX.1 Kenobi
 
Join Date: Apr 2015
Posts: 48
Ozz is on a distinguished road
Default

Quote:
Originally Posted by cory_cole View Post
Did you have anything before?
Only what you suggested earlier in the thread. Otherwise, just "return message;"
Reply With Quote
  #22  
Old 12-12-2019, 06:16 AM
cory_cole cory_cole is offline
Mirth Guru
 
Join Date: Mar 2012
Posts: 1,346
cory_cole is on a distinguished road
Default

Then yes. Replace everything.
Reply With Quote
  #23  
Old 12-12-2019, 07:16 AM
Ozz Ozz is offline
OBX.1 Kenobi
 
Join Date: Apr 2015
Posts: 48
Ozz is on a distinguished road
Default

Quote:
Originally Posted by cory_cole View Post
Then yes. Replace everything.
Thanks. So I have this code in my destination transformer:


Code:
while(message.indexOf('\\E\\') > -1)
{
message = message.replace('\\E\\', '\\\\');
}
return String(message);

And it's returning this error:


Code:
3478: while(message.indexOf('\\E\\') > -1)
3479: {
3480: message = message.replace('\\E\\', '\\\\');
3481: }
3482: return String(message);
LINE NUMBER:	3478
DETAILS:	ReferenceError: "message" is not defined.
Reply With Quote
  #24  
Old 12-12-2019, 07:25 AM
cory_cole cory_cole is offline
Mirth Guru
 
Join Date: Mar 2012
Posts: 1,346
cory_cole is on a distinguished road
Default

That is the preprocessor code.

This is the destination transformer code...

msg = java.lang.String(msg);
while(msg.indexOf('\\\\') > -1)
{
msg = msg.replace('\\\\', '\\E\\');
}
Reply With Quote
  #25  
Old 12-12-2019, 07:42 AM
Ozz Ozz is offline
OBX.1 Kenobi
 
Join Date: Apr 2015
Posts: 48
Ozz is on a distinguished road
Default

Quote:
Originally Posted by cory_cole View Post
That is the preprocessor code.

This is the destination transformer code...

msg = java.lang.String(msg);
while(msg.indexOf('\\\\') > -1)
{
msg = msg.replace('\\\\', '\\E\\');
}
Sorry I misunderstood. Got it as you explain now. Returned this error. Does anything in here hint at a problem elsewhere within the channel?



Code:
SCRIPT SOURCE:	
SOURCE CODE:	
3453:         }
3454:         eval('importPackage(' + Packages.java.lang.Class.forName(className).getPackage().getName() + ')');
3455:     }
3456: }
3457: function doScript() {
3458: msg = new XML(connectorMessage.getTransformedData());
3459: if (msg.namespace('') != undefined) { default xml namespace = msg.namespace(''); } else { default xml namespace = ''; }
3460: function doFilter() { phase[0] = 'filter'; return true; }function doTransform() { phase[0] = 'transformer'; logger = Packages.org.apache.log4j.Logger.getLogger(phase[0]);
3461: 
3462: 
LINE NUMBER:	3458
DETAILS:	TypeError: The content of elements must consist of well-formed character data or markup.
Reply With Quote
  #26  
Old 12-12-2019, 07:54 AM
cory_cole cory_cole is offline
Mirth Guru
 
Join Date: Mar 2012
Posts: 1,346
cory_cole is on a distinguished road
Default

I don't think that it is the /E/ causing the problem. There is probably another character in there that you aren't seeing. In the prepocessor, you can drag the function removeIllegalCharacters in. Try that.
Reply With Quote
  #27  
Old 12-12-2019, 08:23 AM
Ozz Ozz is offline
OBX.1 Kenobi
 
Join Date: Apr 2015
Posts: 48
Ozz is on a distinguished road
Default

Quote:
Originally Posted by cory_cole View Post
I don't think that it is the /E/ causing the problem. There is probably another character in there that you aren't seeing. In the prepocessor, you can drag the function removeIllegalCharacters in. Try that.
Thanks, I will give that a shot. I tried a search for any of the reserved characters and had no match, but maybe there's something else...
Reply With Quote
  #28  
Old 12-12-2019, 08:30 AM
Ozz Ozz is offline
OBX.1 Kenobi
 
Join Date: Apr 2015
Posts: 48
Ozz is on a distinguished road
Default

I added the remove Illegal characters function to the pre-processor, both on its own, before, and then after the other pre-processor script you had given me. All resulted in the same error I'd received already:

DETAILS: TypeError: The content of elements must consist of well-formed character data or markup.


I'm starting to wonder if the message they're sending me is complete garbage. Incidentally we have another interface that sends RTF files, and the path includes the \\ characters. I took an OBX segment from that one, pasted it into this interface, and it went through with the \ characters and all. Why would that be? Shouldn't those \ need to be escaped to process? The other channel where this is running in production does not have any pre/post processor scripts or anything like we've been discussing here. Pretty baffling...
Reply With Quote
  #29  
Old 12-12-2019, 08:47 AM
cory_cole cory_cole is offline
Mirth Guru
 
Join Date: Mar 2012
Posts: 1,346
cory_cole is on a distinguished road
Default

Escaped characters aren't invalid. So, there isn't a problem with them going through.

The message could be bad. There are some invalid characters that aren't visible like null. You could also have a hard return in the middle of a segment.

I would need to be able to see the message to help determine that. If you can post the message (with PHI removed), I can take a look.
Reply With Quote
  #30  
Old 12-12-2019, 08:59 AM
Ozz Ozz is offline
OBX.1 Kenobi
 
Join Date: Apr 2015
Posts: 48
Ozz is on a distinguished road
Default

I was starting to think along those lines. I've worked w/that on other engines but they have a GUI to select the message and view hex encoding. I'm not familiar with doing the same in Mirth - is there a way?

Here is the message.
Attached Files
File Type: txt mdm.txt.txt (14.5 KB, 3 views)
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 02:05 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Mirth Corporation