a web-service-client

So you've set-up your web-services, as described on the page get those services running and you tested them with soapUI and it's all fine, but now you want to put them to use.
To do this, you can use many tools and there's plenty of documentation on the internet, but here we will have a look at a very practical example. It's written in MsAccess-VBA and that's certainly not the optimal solution for a production-environment, but it will do the job and most people have basic skills in Access. We will use it to import StudySubjects from an external database into OpenClinica and to schedule Events for them.


You can download the file here.
Of course we assume you have your web-services running and that you authorized user root to use the SOAP-services.
First unzip the file and open the mdb-file. Then go to the tables-section and open tblSOAPParameters.

fig. 1: setting the URL of the web-service

In it are some parameters and there's one you must change: sysURL: change that to match your situation, and tempdir: change that to the directory you use for temporary files.

getting the Studies

First we must find out which Studies we have running and to do this we open frmGetStudies. Fill in your username and password and click the button get studies. After the Request is made to the web-services, the Response is returned and the result is written into tblOCStudies.

fig. 2: the form for retrieving Studies plus the result

adding Subjects to a Study

Let's say you set up your Study to manually set the StudyIDs, like in figure 3.

fig. 3: settings of the Study

Now open tblNewSubjectToCreate and fill in the fields, except the last field, Response.

fig. 4: new Subjects

The last step is to open the form frmCeateStudySubjects, fill in name and password and choose the Study. If a Study has one or more Sites, you can choose one of the Sites and the Subjects will be assigned to that Site. If you leave this blank, the Subjects will be assigned to the Study. Now click the button create study subjects and you're done.

fig. 5: the form to create new Subjects

For each record you see the result in field Response.

fig. 6: the result

and scheduling Events, is that just as easy?

Truth be told: yes, scheduling Events is just as easy as adding Subjects. We already know which Studies we can use and if we want to know which Events a Study has, we can use web-services as well. To do this, open form frmGetStudyMetaData, again fill in username and password and choose the Study. (Make sure that the Event that you want to schedule has a CRF, otherwise it's OID will not show up in the list of available Events.) The table tblStudyEventDef will contain all the EventOIDs.

fig. 7: form for the Study-metadata and the result in tblStudyEventDef

Now open tblNewEventsToCreate and fill in all fields, except Response. (Does that sound familiar?) Now open form frmCreateEvents and you guessed it: name, password, Study, click it.

fig. 8: table and form

As a bonus you get the StudySubjectOID in the Response!

fig. 9: the result, including the StudySubjectOID

are you serious?

Of course we're serious. Just look at the result:

fig. 10: the result, in real OpenClinica-life

Other how-to-pages can be found here.

this page was last reviewed November 2013