Hi,

I'm having a similar problem with encapsulated data ("ED" type).

I'm sending an ORU^R01 message from a client to a server, both using
hapi 0.5.1. I add two observations to the message using the following
code

 

terser = new Terser(msg);

      OBX obx1 = (ca.uhn.hl7v2.model.v22.segment.OBX) terser

 
.getSegment("/.PATIENT_RESULT/ORDER_OBSERVATION/OBSERVATION(0)/OBX");

      obx1.getObservationIdentifier().getIdentifier().setValue("TEST1");

 
obx1.getObservationIdentifier().getText().setValue("OBSERVATION1");

 
obx1.getObservationIdentifier().getNameOfCodingSystem().setValue("L");

      obx1.getSetIDObservationalSimple().setValue("1");          

      obx1.getValueType().setValue("CE");         

 
terser.set("/.PATIENT_RESULT/ORDER_OBSERVATION/OBSERVATION(0)/OBX-5",
"TESTVALUE");

 

      OBX obx2 = (ca.uhn.hl7v2.model.v22.segment.OBX) terser

 
.getSegment("/.PATIENT_RESULT/ORDER_OBSERVATION/OBSERVATION(1)/OBX");


      obx1.getObservationIdentifier().getIdentifier().setValue("TEST2");

 
obx1.getObservationIdentifier().getText().setValue("OBSERVATION2");

 
obx1.getObservationIdentifier().getNameOfCodingSystem().setValue("L");

      obx2.getSetIDObservationalSimple().setValue("2");      

      obx2.getValueType().setValue("ED");

 
terser.set("/.PATIENT_RESULT/ORDER_OBSERVATION/OBSERVATION(1)/OBX-5-1",
"TEST");

 
terser.set("/.PATIENT_RESULT/ORDER_OBSERVATION/OBSERVATION(1)/OBX-5-2",
"TEXT");

 
terser.set("/.PATIENT_RESULT/ORDER_OBSERVATION/OBSERVATION(1)/OBX-5-3",
"Base64");

 
terser.set("/.PATIENT_RESULT/ORDER_OBSERVATION/OBSERVATION(1)/OBX-5-4",
xmlDocument);

 

The first OBX contains only simple value and sending a message with only
this segment is ok, however when I add the second OBX that contains an
xml document sending is ok, but the receiving application reports an
exception, apparently because there is no constructor.

 

ca.uhn.hl7v2.HL7Exception: java.lang.NullPointerException trying to set
data type of OBX-5

      at ca.uhn.hl7v2.model.Varies.fixOBX5(Varies.java:148)

      at ca.uhn.hl7v2.parser.PipeParser.parse(PipeParser.java:324)

      at ca.uhn.hl7v2.parser.PipeParser.doParse(PipeParser.java:259)

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

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

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

Caused by: java.lang.NullPointerException

      at ca.uhn.hl7v2.model.Varies.fixOBX5(Varies.java:137)

      ... 5 more

 

So far, I haven't been able to find a solution, so any help is
appreciated! Who knows what I am doing wrong? 

 

Kind regards,

Patrick Ehlert.

 

> When parsing an HL7 2.3 ORM message, with the OBX-2 field set to ID,
the

> HAPI (0.5.1) implementation throws the error bellow:

> 

> [java] Caused by: ca.uhn.hl7v2.HL7Exception:

> java.lang.NoSuchMethodException trying to set data type of OBX-5

> [java] at ca.uhn.hl7v2.model.Varies.fixOBX5(Varies.java:148)

> [java] at

> ca.uhn.hl7v2.parser.PipeParser.parse(PipeParser.java:324)

> [java] at

> ca.uhn.hl7v2.parser.PipeParser.doParse(PipeParser.java:259)

> [java] at

> ca.uhn.hl7v2.parser.GenericParser.doParse(GenericParser.java:205)

> [java] at ca.uhn.hl7v2.parser.Parser.parse(Parser.java:151)

> [java] at com.ibm.hl7tools.HL7Reader.read(HL7Reader.java:43)

> [java] ... 27 more

> [java] Caused by: java.lang.NoSuchMethodException:

> ca.uhn.hl7v2.model.v23.datatype.ID.<init>(ca.uhn.hl7v2.model.Message)

> [java] at java.lang.Class.getConstructor0(Class.java:1937)

> [java] at java.lang.Class.getConstructor(Class.java:1027)

> [java] at ca.uhn.hl7v2.model.Varies.fixOBX5(Varies.java:137)

> [java] ... 32 more

> 

> 

> Reading source code, I found that the Varies implementation attempts
to

> call a default constructor on the class

> ca.uhn.hl7v2.model.v23.datatype.ID :

> 

> Class c = factory.getTypeClass(obx2.getValue(),

> segment.getMessage().getVersion());

> v.setData((Type) c.getConstructor(new

> Class[]{Message.class}).newInstance(new Object[]{v.getMessage()}));

> 

> Unfortunately, this constructor does not exist. All defined
constructors

> for the Java type ID expect a table identifier parameter (here it
should

> be 125).

> 

> The issue is that ID _is_ an acceptable value for field OBX-2, as

> defined by the HL7 table 125, release 2.3.

> And the sending application (Millennium) does use this value.

> 

> I could easily patch the HAPI 0.5.1 source code, but I would prefer
not

> to.

> Furthermore, as the spec allow this value, I think this issue may be

> reported as an HAPI bug. Should I create an entry in the issue tracker
?

> 

> Has anyone encounter a similar issue ? what was then the chosen

> solution ? 

> 

> Regards,

> christophe.

 

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Hl7api-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

Reply via email to