Results-Only Interface with Quest via SOAP / HL7

By: Johnathon Wright on: February 20, 2014

Just as a note, SOAP is not only very painful to use, but it's a system that uses HTTP, but ignores all the value you get from HTTP. There are dramatically better options. Check out Designing Hypermedia APIs by Steve Klabnik.

I acknowledge that there is some value is being able to validate messages. But it doesn't, IMO, make up for the pain of implementation.

Get Results ( HL7 w/ Embedded PDF )

I'm using the action 'get_results' with parameters like this:

 'resultsRequest' =>
        'startDate' => self.start_date.to_date.to_s(:mdy),
        'endDate' => self.end_date.to_date.to_s(:mdy),
        'maxMessages' => 30,
        'providerAccounts' => 'THO',
        'retrieveFinalsOnly' => 'false'

and the request looks like this:

SOAP request:
SOAPAction: "getResults"
Content-Type: text/xml;charset=UTF-8
Content-Length: 828

<?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:xsd="" xmlns:xsi="" xmlns:wsdl="" xmlns:env="" xmlns:ins0="java:com.medplus.serviceHub.results.webservice" xmlns:ins1="java:com.medplus.serviceHub.results.webservice.printable" xmlns:ins2="java:javax.xml.rpc" xmlns:ins3="java:javax.xml.soap" xmlns:ins4="java:language_builtins.lang"><env:Body><getResults><wsdl:resultsRequest><wsdl:startDate>08/01/2013</wsdl:startDate> wsdl:endDate>09/01/2013</wsdl:endDate><wsdl:maxMessages>30</wsdl:maxMessages><wsdl:providerAccounts>THO</wsdl:providerAccounts> <wsdl:retrieveFinalsOnly>false</wsdl:retrieveFinalsOnly></wsdl:resultsRequest></getResults></env:Body></env:Envelope>

response looks like this:

<?xml version="1.0"?>
    <env:Envelope xmlns:soapenc="" xmlns:xsd="" xmlns:env="" xmlns:xsi="">
    <env:Body env:encodingStyle="">
      <m:getResultsResponse xmlns:m="">
        <result xmlns:n1="java:com.medplus.serviceHub.results.webservice" xsi:type="n1:ResultsResponse">
          <HL7Messages soapenc:arrayType="xsd:string[2]">
            <string xsi:type="xsd:string">MSH|^~\&|LAB|QTE||12345|20130404215632||ORU^R01|80000000000000053080|D|2.3.1
  CULTURE|||20130404093200|||||||20130404083500||1122334455^ALLEN^JOSEPH^^^^^^^^^^NPI|||||CB^Quest Diagnostics-Wood Dale^1355 Mittel Blvd^Wood Dale^IL^60191-1024^Anthony V Thomas, M.D.|20130805171655|||F
  OBX|1|ST|5778-6^Color Ur^LN^30005500^COLOR^QDIWDL||AMBER||YELLOW|A|||F|||20130805171655|CB
  OBX|2|ST|5767-9^Appearance Ur^LN^30005600^APPEARANCE^QDIWDL||TURBID||CLEAR|A|||F|||20130805171655|CB
  OBX|3|NM|5811-5^Sp Gr Ur Strip^LN^30006000^SPECIFIC GRAVITY^QDIWDL||1.032||1.001-1.035|N|||F|||20130805171655|CB
  OBX|4|NM|5803-2^pH Ur Strip^LN^30006200^PH^QDIWDL||7.8||5.0-8.0|N|||F|||20130805171655|CB

  <snip />

  OBR|9||CB018665A|ClinicalPDFReport1^Clinical PDF Report CB018665A-1^^ClinicalPDFReport1^Clinical PDF Report CB018665A-1|||20130404093200|||||||20130404083500||1122334455^ALLEN^JOSEPH^^^^^^^^^^NPI||||||20130805171655|||F
  OBX|1|ED|ClinicalPDFReport1^Clinical PDF Report CB018665A-1^^ClinicalPDFReport1^Clinical PDF Report CB018665A-1||QTE^Image^PDF^Base64^JVBERi0xLjQKJeLjz9MKMyAwIG9iago8PC9GaWx0ZXIvRmxhdGVEZWNvZGUvTGVuZ3RoIDEwPj5zdHJlYW0KeJwr5AIAAO4Af plbmRzdHJlYW....
  <snip content="large chunks of base64 encoded PDF" />somethingsomethingsomething</string>
          <isMore xsi:type="xsd:boolean">false</isMore>
          <requestId xsi:type="xsd:string">551514a50a801e1512b2a98ed5f30b36</requestId>



Using the response document above, I need the request ID and the message control IDs. The request ID comes from the SOAP document. The message control IDs come from the HL7 MSH segment.

>> response_document.xpath('//requestId').text
=> "551514a50a801e1512b2a98ed5f30b36"

And here's what I send to Quest...

SOAP request:
SOAPAction: "acknowledgeResults"
Content-Type: text/xml;charset=UTF-8
Content-Length: 1029

  <?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:xsd="" xmlns:xsi="" xmlns:wsdl="" xmlns:env="" xmlns:ins0="java:com.medplus.serviceHub.results.webservice" xmlns:ins1="java:com.medplus.serviceHub.results.webservice.printable" xmlns:ins2="java:javax.xml.rpc" xmlns:ins3="java:javax.xml.soap" xmlns:ins4="java:language_builtins.lang">
              MSH|^~&|PhysioAge Reporting|12345|LAB|QTE|201310091854||ACK|1372089260531|D|2.3.1
              MSH|^~&|PhysioAge Reporting|12345|LAB|QTE|201310091854||ACK|1372089260531|D|2.3.1

and I get back:

  <env:Envelope xmlns:soapenc="" xmlns:xsd="" xmlns:env="" xmlns:xsi=""><env:Header></env:Header> 
 <env:Body env:encodingStyle=""><m:acknowledgeResultsResponse xmlns:m=""></m:acknowledgeResultsResponse></env:Body></env:Envelope>


off white shoes said: I'm just writing to make you be aware of of the exceptional encounter my wife's girl found going through yuor web blog. She learned a good number of issues, including how it is like to possess an awesome coaching heart to get other folks just fully grasp various complex topics. You truly exceeded my expectations. I appreciate you for offering those necessary, healthy, edifying and in addition fun tips about your topic to Ethel. off white shoes [url=]off white shoes[/url]

supreme new york said: I am glad for writing to let you know what a terrific encounter my daughter developed using the blog. She mastered plenty of issues, with the inclusion of how it is like to possess a very effective giving nature to let certain people completely understand a number of hard to do matters. You undoubtedly did more than readers' desires. Thanks for displaying such priceless, dependable, educational and as well as unique tips on that topic to Sandra. supreme new york

ferragamo belt said: I want to show my thanks to this writer just for rescuing me from such a predicament. As a result of browsing throughout the world wide web and obtaining tricks which were not pleasant, I believed my entire life was gone. Living minus the strategies to the problems you have resolved through the write-up is a crucial case, and the kind which may have in a negative way affected my entire career if I hadn't discovered your website. That knowledge and kindness in maneuvering a lot of stuff was vital. I don't know what I would have done if I had not come across such a stuff like this. I'm able to at this time relish my future. Thanks a lot so much for this skilled and result oriented guide. I won't hesitate to refer your web sites to anybody who will need guidance about this matter. ferragamo belt

nike air vapormax said: I together with my guys appeared to be digesting the best guidelines located on your site and so the sudden came up with a terrible feeling I never expressed respect to the web blog owner for those tips. The men are already as a result warmed to read through all of them and already have in truth been tapping into these things. Thanks for turning out to be considerably kind and also for pick out variety of terrific subject areas most people are really eager to know about. Our own sincere regret for not saying thanks to you earlier. nike air vapormax

nike air max 90 said: I just wanted to type a quick remark to appreciate you for all the amazing solutions you are sharing on this site. My time-consuming internet research has at the end of the day been compensated with awesome facts to talk about with my good friends. I would state that that we website visitors actually are quite endowed to live in a fantastic place with so many marvellous professionals with very beneficial guidelines. I feel very fortunate to have discovered your entire weblog and look forward to many more amazing minutes reading here. Thank you again for everything. nike air max 90

yeezy boost 500 said: I precisely wanted to say thanks yet again. I am not sure the things that I could possibly have achieved without the type of tactics revealed by you relating to my question. It had become an absolute frightful condition in my circumstances, however , being able to see the expert fashion you treated the issue made me to weep over fulfillment. Now i'm happy for the assistance as well as sincerely hope you really know what a powerful job you are always putting in educating the others by way of your site. Probably you haven't encountered all of us. yeezy boost 500

jordan 11 said: I want to get across my respect for your generosity supporting folks that really want help with this one area. Your very own commitment to getting the message up and down appears to be wonderfully valuable and has constantly encouraged those much like me to get to their dreams. Your new warm and helpful key points denotes much a person like me and a whole lot more to my fellow workers. Best wishes; from everyone of us. jordan 11

curry 4 said: I am only commenting to make you understand of the exceptional discovery my wife's princess gained using your blog. She even learned some things, most notably what it's like to have an awesome helping style to make other people smoothly know just exactly specified tortuous topics. You undoubtedly did more than our own desires. Thanks for presenting those helpful, safe, revealing and even unique guidance on that topic to Emily. curry 4