We hope you'll join us for our 4/23 webinar on using data tables to apply reference ranges and AE codes in OC4. For more information and to register, visit https://register.gotowebinar.com/register/2882170018956684555

How to fill CRFs in OpenClinica OpenSource/Community Edition EDC using SOAP/REST?

Hi,

I have just setup OpenClinica community edition EDC with the JUNO diabetes study DB provided in the OpenClinica documentation. It is version 3.14. Now, I want to fill in CRFs or retrieve data from CRF using SOAP/REST. Could someone provide me end to end means from authentication to entry/retrieval of data? It would be of great help...thanks.
«1

Comments

  • GerbenRienkGerbenRienk Posts: 838 ✭✭✭
    Hi Ravi,
    For 3.14 you would need the web-servcies to import data, see for example http://www.trialdatasolutions.com/tds/howto/wssetup.jsp
    For retrieving data you could use rest and you would authenticate using j_spring_security_check It depends on your programming environment how you would do that, but for vba, have a look at http://www.trialdatasolutions.com/tds/howto/scripttorunarule.jsp
    If you would like use the same construct to download clinical data, the vbs-script would be something like:

    Option explicit
    Dim objIEDebugWindow
    Dim objHTTP
    Dim strURLStart
    Dim strURL
    Dim strReq
    Dim objFSO
    Dim objFile
    Dim fileName

    Set objFSO=CreateObject("Scripting.FileSystemObject")

    If WScript.Arguments.Count <> 3 then
    WScript.Echo "Missing parameters. This script needs: "_
    & VbNewLine & "username, password and StudyOID"_
    & VbNewLine & "to run correctly."
    Else
    'build the file name
    fileName = "d:\temp\" & WScript.Arguments(2) & ".json"
    Set objFile=objFSO.CreateTextFile(fileName,2,true)
    Set objHTTP = CreateObject("MSXML2.XMLHTTP")
    'change this to match your situation
    strURLStart = "https://trialdatasolutions.com/OpenClinica/"
    'j_spring_security_check
    strURL = strURLStart & "j_spring_security_check?j_username=" & WScript.Arguments(0)
    strURL = strURL & "&j_password=" & WScript.Arguments(1)
    objHTTP.Open "POST", strURL, False
    objHTTP.send
    'uncomment the next line if you want to check if the authorization went OK
    'debug (objHTTP.responseText)

    'request the data in json
    strURL = strURLStart & "rest/clinicaldata/json/view/" & WScript.Arguments(2) & "/*/*/*"
    'WScript.Echo strURL
    objHTTP.Open "GET", strURL, False
    objHTTP.send
    'write the result to disk
    objFile.Write(objHTTP.responseText)

    'uncomment the next line if you want to check if the request went OK
    'debug (objHTTP.responseText)
    'WScript.Echo "finished"
    End if

    'the following procedure is used to check the responses of the HTTP requests
    'it opens a browser window and displays whatever is given as parameter myText
    Sub Debug( myText )
    'open a browser window if it is not already open
    If Not IsObject( objIEDebugWindow ) Then
    Set objIEDebugWindow = CreateObject( "InternetExplorer.Application" )
    objIEDebugWindow.Navigate "about:blank"
    objIEDebugWindow.Visible = True
    objIEDebugWindow.ToolBar = False
    objIEDebugWindow.Width = 200
    objIEDebugWindow.Height = 300
    objIEDebugWindow.Left = 10
    objIEDebugWindow.Top = 10
    Do While objIEDebugWindow.Busy
    WScript.Sleep 100
    Loop
    objIEDebugWindow.Document.Title = "IE Debug Window"
    objIEDebugWindow.Document.Body.InnerHTML = "" & Now & ""
    End If
    'add the text from the parameter to what's already there
    objIEDebugWindow.Document.Body.InnerHTML = _
    objIEDebugWindow.Document.Body.InnerHTML _
    & myText & "
    " & vbCrLf
    End Sub

    Kind regards,
    Gerben Rienk
  • kkristiansonkkristianson Posts: 24
    :* Happy New Year, Gerbin and thanks for all your help in the years past!!
  • kkristiansonkkristianson Posts: 24
    Sorry Gerben for the misspselled name! :)
    K
  • RaviVRaviV Posts: 30
    edited January 3
    Thank you Gerben
  • RaviVRaviV Posts: 30
    edited January 3
    Hi,

    I have setup the webservice app as well. The authentication is successful through SOAP (used SOAPUI tool) - Thanks Gerben. Manually I prepared an xml and did DataImport in the application, which is working fine, i.e., filling a CRF. But I want to do that through a SOAP call (REST is also fine, in fact better) i.e., send a request to the OpenClinica-ws application that I created with the xml that I already prepared and the data should sit in the OpenClinica for the subject. What is that SOAP request format and the end point please?

    Thanks,
    Ravi.
  • GerbenRienkGerbenRienk Posts: 838 ✭✭✭
    Hi Ravi,
    The endpoint is http://your_server/OpenClinica/ws/event/v1/eventWsdl.wsdl and there's some documentation on http://docs.openclinica.com/3.1/technical-documents/openclinica-web-services-guide/data-web-service (skip the first paragraph and start at SOAP XML Request and Response Template.
    This is however not accurate! You should insert the content of the odm-xml-file that you manually imported between
    <v1:importRequest>
    and
    </v1:importRequest>
    Hope his helps,
    Gerben Rienk
  • RaviVRaviV Posts: 30
    edited January 4
    Hi Gerben,

    As per the link, I think we need to use dataWsdl i.e., http://myserver:port/OpenClinica-ws/ws/data/v1/dataWsdl.wsdl

    I inserted the xml between importRequest tag.
    But, I got the response saying, xml is not well-formed. I think I am close .. but unable to figure out as I just did copy paste ...

    Note: I also tested with online xml validators, all good.

    -Ravi.
    Post edited by RaviV on
  • GerbenRienkGerbenRienk Posts: 838 ✭✭✭
    Hi Ravi,
    Can you take out the username and password from the header and attach the request to the forum?
    Thank you,
    Gerben Rienk
  • RaviVRaviV Posts: 30
    Hi Gerben,

    Thanks.
    PFA 2 files. soapui_file.txt (actually xml) is the file I sent via SOAPUI tool - which is not successful as it failed saying xml is not well formed. The other file 'dataimport_file.txt'(actually xml) is the xml I uploaded using the Import Data feature in the OpenClinica - which is successful. The only difference in the 2 xmls is one is a subset of the other except the first line in the dataimport_file.xml that is xml version as it is not accepted in the soup ui xml.

    Thanks,
    Ravi.
  • RaviVRaviV Posts: 30
    Hi Gerben,

    Thanks.
    PFA 2 files. soapui_file.txt (actually xml) is the file I sent via SOAPUI tool - which is not successful as it failed saying xml is not well formed. The other file 'dataimport_file.txt'(actually xml) is the xml I uploaded using the Import Data feature in the OpenClinica - which is successful. The only difference in the 2 xmls is one is a subset of the other except the first line in the dataimport_file.xml that is xml version as it is not accepted in the soup ui xml.

    Thanks,
    Ravi.
Sign In or Register to comment.