A newbie question.


I've a problem with a client using HAPI that I don't know  how to address.



The problem is that it send us an invalid XML message with a HL7 message
inside.

the message has the structure of:

<ADT_A01>

    <MSH>

        <MSH.1>|</MSH.1>

...



If I send it to my application I got this error: ca.uhn.hl7v2.HL7Exception:
Namespace URI must be urn:hl7-org:v2xml



If I manually send it modifying the xml to begin with:

<?xml version="1.0" encoding="UTF-8"?>

<ADT_A01 xmlns="urn:hl7-org:v2xml">

    <MSH>

...



Everything works fine.



So I'm trying to "intercept" the received messages and manually add the
<?xml version="1.0" encoding="UTF-8"?>

line and modify the <ADT_A01> with <ADT_A01 xmlns="urn:hl7-org:v2xml">

How can I achieve this with HAPI libraries?



Perhaps it's a bad idea trying to solve this way so any comments how to
solve it?

If my idea is "good enough" I've tried this but it does not work:



My code following the tutorials does:



HapiContext context = new DefaultHapiContext();

HL7Service server = context.newServer(listenerHL7port, useTls);

ReceivingApplication handler = new MyHandler();

server.registerApplication("*", "*", handler);



Inside MyHandler class that implements ReceivingApplication, inside the
inherited method  processMessage we've done a fixMessage method that returns
a String with the fixed message using as source
theOriginalMessage.toString(), the logic seems simple BUT the processMessage
in MyHandler is  NEVER called, Exception is thrown BEFORE arriving to this
handler method, so the message is processed before the handler is called and
fails before I can do anything.



Complete exception thrown:

at ca.uhn.hl7v2.parser.XMLParser.assertNamespaceURI(XMLParser.java:272)

                at
ca.uhn.hl7v2.parser.DefaultXMLParser.parseDocument(DefaultXMLParser.java:173
)

                at ca.uhn.hl7v2.parser.XMLParser.doParse(XMLParser.java:193)

                at
ca.uhn.hl7v2.parser.GenericParser.doParse(GenericParser.java:245)

                at ca.uhn.hl7v2.parser.Parser.parse(Parser.java:212)

                at
ca.uhn.hl7v2.parser.GenericParser.parse(GenericParser.java:253)

                at
ca.uhn.hl7v2.protocol.impl.ApplicationRouterImpl.processMessage(ApplicationR
outerImpl.java:132)

                at
ca.uhn.hl7v2.protocol.impl.ApplicationRouterImpl.processMessage(ApplicationR
outerImpl.java:99)

                at
ca.uhn.hl7v2.app.Responder.processMessage(Responder.java:91)

                at ca.uhn.hl7v2.app.Receiver$Grunt.run(Receiver.java:127)

                at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)

                at java.util.concurrent.FutureTask.run(FutureTask.java:266)

                at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:11
42)

                at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:6
17)

                at java.lang.Thread.run(Thread.java:745)







---
El software de antivirus Avast ha analizado este correo electrónico en busca de 
virus.
https://www.avast.com/antivirus
_______________________________________________
Hl7api-devel mailing list
Hl7api-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

Reply via email to