Announcement

Collapse

Mirth Connect 4.3.0 Released!

Mirth Connect 4.3.0 is now available as an appliance update and on our GitHub page.

This is a major release containing new features like adding new functionality to the Mirth Connect Setup Wizard, adding the ability for resource and channel-specific classloaders to load child-first or parent-first, and added a default implementation of the getObjectsForSwaggerExamples() method in the ServicePlugin class. This release also contains enhancements for the Mirth Connect Administrator Launcher, the Mirth Connect Docker images, and several bug fixes and security improvements.

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

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

Simple SOAP sender throws SAXParseException

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

  • Simple SOAP sender throws SAXParseException

    I have a very simple chanel, with a file reader and a SOAP sender, but when I try to send the following simple message:

    MSH|^~\\&|HCE||LIS||20061117092345||QRY^R02|41581| P|2.5
    QRD|20061117092345|R|I|41581|||1^RD|ORD|105238
    QRF||20061116000000|20061116235959

    I get the following exception:

    org.xml.sax.SAXParseException: The entity name must immediately follow the '&' in the entity reference.

    If I replace then '&' sympol by '#' in the MSH segment, then the message is sent without problems.

    Do I need to set any transformer for this simple situation? How can I avoid this exeption?

    Thanks!

  • #2
    Re:Simple SOAP sender throws SAXParseException

    Can you post your channel? Thanks!
    Chris Lang

    Comment


    • #3
      Re:Simple SOAP sender throws SAXParseException

      This is because the MSH semegment in non-compliant HL7 er7 syntax

      MSH|^~&|
      is a wrong secuence of encoding characters It should be:

      MSH|^~\\&|

      (The escape character (\\) should be defined previous to the sub-filed separator (&)

      This can be solved using the preprocessor script, with a replace JS function. Search in the forum, there are a lot of post about how to use it.

      Comment


      • #4
        Re:Simple SOAP sender throws SAXParseException

        Alberto -

        I believe the MSH segment is correct, however the forum is stripping out the slash. When posting HL7 or code, wrap the text in the [ code ] tags.

        Pablo Leon -

        You are getting your entity error because the SOAP sender is trying to send the raw HL7 - however it needs to send valid XML. Since the & character can not be used by itself in valid XML, you need to either replace amperstands with
        Code:
        &
        or (the best solution)you need to set your SOAP sender to wrap the message data with an entity encoder.

        When you drag your message variable to the SOAP sender, also drag "entity encoder". Your soap value should look something like:

        Code:
        encoder.encode(messageObject.rawData)
        The encoder will convert XML characters to the proper entities. You can use encoder.decode to convert entities back to the normal characters. The encoder can be used anywhere in your Javascript, as well on any file, llp, tcp, soap, etc template on the destination tab.

        Hope this helps!
        Chris Lang

        Comment


        • #5
          Re:Simple SOAP sender throws SAXParseException

          Thanks Chrisl, now I have the channel running almost smooth. :laugh:

          But, some of our messages have international characters (in Spain, we have a few Ñ). When this messages are processed, we obtain the following exception:

          org.xml.sax.SAXParseException: The entity "Ntilde" was referenced, but not declared.

          Comment


          • #6
            Re:Simple SOAP sender throws SAXParseException

            The 1.5.1 release of Mirth will give you the ability to turn automatic entity encoding off.
            Chris Lang

            Comment


            • #7
              Re:Simple SOAP sender throws SAXParseException

              Chirsl, I have seen you have posted a 1.5 patch1, and I have tried it, but the problem still persists. When is the 1.5.1 release scheduled?

              Comment

              Working...
              X