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

nike shoes for men said: I precisely desired to say thanks again. I'm not certain what I would've tried in the absence of the actual opinions provided by you concerning my situation. It had been an absolute frightful concern for me, nevertheless coming across the very skilled mode you processed the issue took me to leap for happiness. I am happy for your information as well as pray you find out what an amazing job you are providing instructing the mediocre ones by way of your websites. Most likely you've never come across all of us. nike shoes for men

golden goose sneakers said: Can I simply say what a relief to search out someone who actually is aware of what theyre speaking about on the internet. You definitely know how one can carry a difficulty to mild and make it important. More folks must read this and understand this aspect of the story. I cant consider youre no more well-liked because you undoubtedly have the gift. golden goose sneakers

supreme shirt said: very good post, i actually love this website, carry on it supreme shirt

off white nike said: you have an ideal weblog here! would you like to make some invite posts on my blog? off white nike

jordan retro said: The subsequent time I read a blog, I hope that it doesnt disappoint me as a lot as this one. I imply, I know it was my option to learn, but I actually thought youd have one thing attention-grabbing to say. All I hear is a bunch of whining about something that you could possibly fix if you happen to werent too busy looking for attention. jordan retro

off white hoodie said: I'm often to running a blog and i really appreciate your content. The article has actually peaks my interest. I am going to bookmark your site and maintain checking for brand new information. off white hoodie

yeezy shoes said: very good post, i definitely love this web site, keep on it yeezy shoes

jordans said: There is noticeably a bundle to know about this. I assume you made certain nice factors in options also. jordans

supreme shirt said: Can I simply say what a reduction to find somebody who really knows what theyre speaking about on the internet. You definitely know the way to convey an issue to gentle and make it important. More folks have to learn this and understand this facet of the story. I cant believe youre not more in style because you positively have the gift. supreme shirt

jordans said: I found your blog website on google and check just a few of your early posts. Proceed to maintain up the very good operate. I just extra up your RSS feed to my MSN News Reader. In search of ahead to reading extra from you later on!? jordans

hermes handbags said: After I initially commented I clicked the -Notify me when new feedback are added- checkbox and now each time a remark is added I get 4 emails with the identical comment. Is there any approach you'll be able to remove me from that service? Thanks! hermes handbags

westbrook shoes said: Hiya! I simply would like to give an enormous thumbs up for the nice information you will have right here on this post. I shall be coming back to your blog for extra soon. westbrook shoes

lebron james shoes said: Would you be all in favour of exchanging links? lebron james shoes

stone island sale said: Aw, this was a really nice post. In idea I would like to put in writing like this additionally ?taking time and precise effort to make a very good article?but what can I say?I procrastinate alot and in no way appear to get one thing done. stone island sale

jordan 4 said: Youre so cool! I dont suppose Ive learn anything like this before. So nice to search out someone with some original thoughts on this subject. realy thank you for beginning this up. this website is something that is wanted on the net, someone with a bit originality. helpful job for bringing something new to the internet! jordan 4

supreme outlet said: I used to be very pleased to seek out this internet-site.I needed to thanks to your time for this glorious read!! I undoubtedly having fun with every little bit of it and I have you bookmarked to take a look at new stuff you blog post. supreme outlet

cheap jordans said: I found your weblog web site on google and check a couple of of your early posts. Proceed to keep up the excellent operate. I just further up your RSS feed to my MSN News Reader. Looking for forward to reading more from you in a while!? cheap jordans

kyrie irving shoes said: A lot of thanks for your own hard work on this web page. Gloria takes pleasure in engaging in investigations and it's really simple to grasp why. I learn all regarding the powerful medium you create advantageous tips and hints on this website and attract contribution from some other people on the topic while our own daughter is now studying a whole lot. Have fun with the remaining portion of the new year. You have been carrying out a brilliant job. kyrie irving shoes

steph curry shoes said: I'm just commenting to let you be aware of what a incredible experience my child developed checking your blog. She even learned such a lot of pieces, not to mention what it is like to have an incredible teaching nature to get a number of people with no trouble comprehend some problematic things. You actually did more than visitors' expectations. Thank you for supplying those effective, trusted, informative not to mention fun tips on this topic to Evelyn. steph curry shoes

golden goose sneakers said: I together with my friends came studying the best pointers from your web site while unexpectedly I had a terrible suspicion I never thanked you for those strategies. The ladies were so excited to study all of them and now have in reality been enjoying those things. We appreciate you truly being quite accommodating and also for deciding on varieties of fantastic themes most people are really needing to be aware of. Our sincere regret for not saying thanks to earlier. golden goose sneakers

off white x jordan 1 said: I needed to write you this bit of remark to be able to say thanks a lot as before for all the pretty concepts you've shared at this time. It is quite surprisingly open-handed with you to provide freely exactly what a lot of people would've supplied as an electronic book to end up making some money for their own end, chiefly considering the fact that you might well have done it if you considered necessary. The principles as well served as the fantastic way to realize that other people have similar eagerness much like my very own to realize a great deal more on the subject of this issue. I think there are thousands of more pleasurable instances up front for those who view your blog post. off white x jordan 1

birkin bag said: Needed to post you this little observation to say thanks once again on your marvelous principles you've documented in this case. This has been generous with you giving publicly precisely what some people might have made available for an e book to generate some profit for their own end, most importantly given that you could possibly have tried it if you desired. The principles likewise acted to become a good way to be certain that many people have a similar interest the same as mine to know the truth a lot more concerning this problem. I'm certain there are a lot more pleasant situations in the future for those who take a look at your blog. birkin bag

golden goose said: I simply needed to appreciate you once again. I am not sure the things that I could possibly have undertaken without these information discussed by you about such subject matter. It has been a real frightful dilemma in my opinion, but discovering your expert way you dealt with it made me to weep for joy. I will be happy for this support and thus wish you recognize what a powerful job your are putting in educating most people through a web site. Probably you have never met any of us. golden goose

hermes belt said: I want to express my gratitude for your generosity supporting women who really need guidance on this particular subject matter. Your very own dedication to getting the message along came to be quite informative and have continuously empowered those just like me to achieve their pursuits. Your personal informative useful information implies a great deal to me and much more to my colleagues. Many thanks; from all of us. hermes belt

jordan shoes said: I am also commenting to make you know what a fabulous discovery my cousin's girl had reading the blog. She even learned some issues, most notably what it's like to have an incredible giving mood to make a number of people completely grasp certain advanced topics. You undoubtedly surpassed my expectations. Many thanks for coming up with such productive, safe, revealing and easy tips on this topic to Sandra. jordan shoes