Announcement

Collapse

Mirth Connect 3.12.0 Released!

Mirth Connect 3.12.0 is now available as an appliance update and on our GitHub page. This release includes database performance improvements, improves visual HL7 representation, message pruning, keystore handling, PDF generation, community contributions, and fixes several security vulnerabilities. This release also contains many improvements to commercial extensions. See the release notes for the list of fixes and updates.

Download | See What's New | Upgrade Guide | Release Notes

For discussion on this release, see this thread.
See more
See less

Pre-processing HL7 embedded in and XML message

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Pre-processing HL7 embedded in and XML message

    I am having difficulty doing anything in the pre-processor script. I seem to be missing something about the environment. The HL7 payload in the XML is in Base64 and I can not get it decoded. Here is the information:

    Code:
    // Modify the message variable below to pre process data
    
    var m = new XML(message);
    
    logger.error(message);
    
    var payload = m['Payload'].toString();
    logger.error(payload);
    
    logger.error('AAA');
    FileUtil.decode(payload);
    logger.error('BBB');
    
    logger.error(payload);
    
    message = payload;
     
    return message;
    The log has the following:
    Code:
    ERROR 2007-09-26 09:23:52,281 [_soapConnector#15904854.soap:MirthHL7toXML.receiver.3] preprocessor: <Doc>
    <UserId>Test</UserId>
    <Password>dGVzdA==</Password>
    <Payload>TVNIfF5+XCZ8U2VuZGluZ0FwcHx8UmVjZWl2aW5nQXBwfHwyMDA2MDExODEzNTMyNXx8U0lVXlMxNXxlNmFlMGU1NS03YmFhLTQyYmUtYTQyMy04ZTJlYTM4ZDJiNDZ8UHwyLjN8fHx8ClNDSHx8QUQxMDAxfHx8fHxQYWNlbWFrZXIgQ2hlY2t8UGFjZW1ha2VyIENoZWNrfDMwfG18Xl4xODAwXjIwMDkwOTA5MDkwOXx8fHx8amRvZXx8fHxqZG9lfHx8fHxBcnJpdmVkXkNoZWNrZWQgSW4KUElEfDF8fEQxMDAxfHxMYXN0MDAwMV5GaXJzdF5NfHwxOTAwMDEwMTAwMDAwMHxNfHx8MSBNYWluIFN0XkFwdCBBXlNJVTQwIENpdHleTU5eMXx8KDExMSkxMTEtMDAwMXwoMjIyKTIyMi0wMDAxfHxTaW5nbGV8fHwzMzMtMjItNDQ0NHx8fHx8fHx8fHx8TgpQVjF8MXxPfF5eXjReXl5eXlNvbWUgSGVhcnQgSW5zdGl0dXRlIExMQ3x8fHx8ODM2XkRvZV5UaG9tYXNeUF5NRF5eXl4mQzk3MjY1JlVQSU58fHx8fHx8fHx8fHxNZWRpY2FyZSBPbmx5fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8MTExMjU2ClJHU3wxfEF8MTExMjU2CkFJR3wxfHwxXkNsaW5pYyBQYWNlciBDaGVja3x8fHx8MjAwNjAxMTgxMzUzMjV8fHwzMHxtaW51dGVzCkFJTHwxfHxeXl43fFBsYWNlIG9mIFNlcnZpY2UKQUlQfDF8fHxEb2N0b3J8fDIwMDYwMTE4MTM1MzI1fHx8MzB8bWludXRlcwoKfA==</Payload>
    </Doc>
    ERROR 2007-09-26 09:23:52,281 [_soapConnector#15904854.soap:MirthHL7toXML.receiver.3] preprocessor: TVNIfF5...cwoKfA==
    ERROR 2007-09-26 09:23:52,281 [_soapConnector#15904854.soap:MirthHL7toXML.receiver.3] preprocessor: AAA
    ERROR 2007-09-26 09:23:52,281 [_soapConnector#15904854.soap:MirthHL7toXML.receiver.3] com.webreach.mirth.connectors.soap.ServiceProxy$AxisServiceHandler: org.mule.umo.routing.RoutingException: Failed to transform message before applying the filter. Failed to route event via endpoint: ImmutableMuleEndpoint{[email protected]13efd0b, endpointUri=soap://localhost:2100/services, transformer=Transformer{name='SOAPRequestToString', returnClass=false, returnClass=false, sourceTypes=[]}, name='_soapEndpoint#-469336871', type='receiver', properties={}, [email protected], filter=null, deleteUnacceptedMessages=false, initialised=true, securityFilter=null, synchronous=true, initialState=started, createConnector=0}. Message payload is of type: [Ljava.lang.Object;
    What is going on? As you can see the decode method does not work.

    Scott HL7_to_XML_Transformers.xml (32264 bytes)

    Post edited by: [email protected], at: 09/26/2007 08:51

    Post edited by: [email protected], at: 09/26/2007 08:54

    Post edited by: [email protected], at: 09/26/2007 09:34

  • #2
    Re:Pre-processing HL7 embedded in and XML message

    Code:
    payload = FileUtil.decode(payload);
    The decode method returns the decoded string back to you, it doesn't modify the variable in place.

    Post edited by: chrisl, at: 09/26/2007 11:20
    Chris Lang

    Comment


    • #3
      Re:Pre-processing HL7 embedded in and XML message

      I tried that and it still fails exactly the same way. For some reason the decode is throwing an error. The Base64 string was encoded using .NET standard conversions.

      I also got an error when I attempted to write the payload string to a file from the pre-processor.

      I am totally at a loss as to what to do.

      Comment


      • #4
        Re:Pre-processing HL7 embedded in and XML message

        Two things -

        Your the base64 decoder gives you a byte array - if this is String data, do

        Code:
        payload = new String(FileUtil.decode(payload));
        Alternatively you can try:

        Code:
        var decoder = new Packages.sun.misc.BASE64Decoder();
        payload = new String(decoder.decodeBuffer(payload));
        What platform is this on?
        Chris Lang

        Comment


        • #5
          Re:Pre-processing HL7 embedded in and XML message

          This is on Windows Server 2003.

          The same problem still ocurrs with your suggestion.

          I think it has to have something to do with the base64 encoding. I encode in .NET 2.0. Or does it have something to do with 8 bit ASCII strings in .NET - I do not know how Java handles strings - I am a .NET developer, not Java.

          Post edited by: [email protected], at: 09/27/2007 08:30

          Comment

          Working...
          X