none
Integrating our VB6 application with HealthVault RRS feed

  • Question

  • We have a fairly large clinical system clinical (EMR) system written in VB6. (Yes I know, we are old school. Please don't reply with upgrade to .NET.)

    We want to send our XML based CCD to HealthVault via the WebService using the Pickup/Drop Off methadology.

    Currently for other WebService applications, we use a PostWebService function that relies on XML-SOAP (I belive that is what is called.)

    How can we send CCD's to HealthVault using this method? Is there any other way of sending to HealthVault with VB6? Our code to post to webservices is below.

    Public Function PostWebservice(ByVal AsmxUrl As String, ByVal SoapActionUrl As String, ByVal XmlBody As String) As String
        Dim objDom As Object
        Dim objXmlHttp As Object
        Dim strRet As String
        Dim intPos1 As Integer
        Dim intPos2 As Integer
       
        On Error GoTo Err_PW
       
        ' Create objects to DOMDocument and XMLHTTP
        Set objDom = CreateObject("MSXML2.DOMDocument")
        Set objXmlHttp = CreateObject("MSXML2.XMLHTTP")
       
        ' Load XML
        objDom.async = False
        objDom.loadXML XmlBody

        ' Open the webservice
        objXmlHttp.Open "POST", AsmxUrl, False
       
        ' Create headings
        objXmlHttp.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
        objXmlHttp.setRequestHeader "SOAPAction", SoapActionUrl
       
        ' Send XML command
        objXmlHttp.Send objDom.XML

        ' Get all response text from webservice
        strRet = objXmlHttp.ResponseText
       
        ' Close object
        Set objXmlHttp = Nothing
       
        ' Extract result
        'intPos1 = InStr(strRet, "Result>") + 7
        'intPos2 = InStr(strRet, "</")
        'If intPos1 > 7 And intPos2 > 0 Then
        '    strRet = Mid(strRet, intPos1, intPos2 - intPos1)
        'End If
       
        ' Return result
        PostWebservice = strRet
       
    Exit Function
    Err_PW:
        PostWebservice = "Error: " & Err.Number & " - " & Err.Description

    End Function

    Friday, November 5, 2010 12:54 AM

Answers

  • It's probably going to be difficult.

    Sending the CCD is something that you could probably code in VB6 using your current approach, but unfortunately there is an authorization/authentication handshake that happens between the HealthVault platform and the application that would require a fair bit of code and using to the windows cryptographic functions. I'm not sure how feasible it is.

    Two other possible approaches.

    You could host a web service someplace that does the communication with HealthVault and have your VB6 program talk to it. That would be pretty simple to write, though you would need to figure out how to authenticate your VB6 app with the web service, and you could call it directly using the same sort of code you are using now.

    Another option is to try to use the .NET APIs through COM interop. It should be possible to make it work but I haven't tried it so I can't give a sense of the difficulty. If you wanted to explore that, my recommendation would be to start by creating a OfflineWebApplicationConnection instance, creating a Weight instance, and then seeing if you could call ConnectPackage.Create() successfully.

    You can get a sense of how to do that in the DOPU sample. You would need to create an application that has access to the ConnectPackage method and then use that application id, and you would also need to have a certificate accessible on the client side. Even though you aren't planning on coding in .NET, I'd use the application manager to create the application - it will put the certificate in the right place in the certificate store. It should also be possible to use the certificate filename option instead of having it in the store, but I might have to think a bit on that one.

    Hope that helps, and let me know if you have more questions.

    Friday, November 5, 2010 5:52 PM