Package ca.cdr.test.app.clients
Class HL7V2RestClient
java.lang.Object
ca.cdr.test.app.clients.HL7V2RestClient
A REST client for sending HL7V2 messages to a Smile CDR server.
-
Method Summary
Modifier and TypeMethodDescriptionstatic HL7V2RestClient
Build a new HL7V2RestClient with the given base URL, username, and password.ca.uhn.hl7v2.model.Message
sendMessage
(ca.uhn.hl7v2.model.Message theMessage) Send a pre-parsed HL7V2 message to the server.ca.uhn.hl7v2.model.Message
sendMessage
(String theMessage) Send an HL7V2 message to the server.
-
Method Details
-
build
public static HL7V2RestClient build(String theBaseUrl, @Nullable String theUsername, @Nullable String thePassword) Build a new HL7V2RestClient with the given base URL, username, and password.- Parameters:
theBaseUrl
- The base URL of the HL7V2 endpoint, including port if needed.theUsername
- The username for authentication (optional)thePassword
- The password for authentication (optional)- Returns:
- A new HL7V2RestClient
-
sendMessage
@Nonnull public ca.uhn.hl7v2.model.Message sendMessage(String theMessage) throws ca.uhn.hl7v2.HL7Exception Send an HL7V2 message to the server.- Parameters:
theMessage
- The HL7V2 message to send- Returns:
- The response message from the server
- Throws:
ca.uhn.hl7v2.HL7Exception
- If there is an error parsing the response
-
sendMessage
@Nonnull public ca.uhn.hl7v2.model.Message sendMessage(ca.uhn.hl7v2.model.Message theMessage) throws ca.uhn.hl7v2.HL7Exception Send a pre-parsed HL7V2 message to the server.- Parameters:
theMessage
- The pre-parsed HL7V2 message to send- Returns:
- The response message from the server
- Throws:
ca.uhn.hl7v2.HL7Exception
- If there is an error encoding the message or parsing the response
-