Questionmark's Open Assessment Platform

Using ASP to add participants to Perception through QMWISe

This page provides some example ASP code that can be used to link to your QMWISe APIs and create participants.

In the following example we use the SOAP Toolkit to make a connection to QMWISe.

The example ASP page can be downloaded from here (LINK NEEDED!).

To use the example place it on a web server that can contact your Perception installation via HTTP. The web server must also be capable of parsing ASP pages (for example, IIS). Install the SOAPToolKit on the server and create or place the example code in a web share.

Now browse to the example ASP file in a web browser. You should see something similar to the following:

The code:

<%' ' This example deomonstrates how to use QMWise to:' Add a participant to the Perception Particpant table' Assign a participant to a group' Provide a list of Perception groups'' This example uses the MS objects for building SOAP request. (The SOAP Toolkit must be installed)' http://www.microsoft.com/downloads/details.aspx?FamilyId=C943C0DD-CEEC-4088-9753-86F052EC8450&displaylang=en' MSSOAP.SoapSerializer30' MSSOAP.HttpConnector30' The MS XML DOM object is used to parse the SOAP responses ' Msxml2.DOMDocument''' There are 2 groups of functions in this source file. The first group contains functions that implement the exampe. These' functions make calls into the second set of functions that provide functionality for creating the SOAP/QMWise request.'' Functions to implement the example' Function CreateParticipant(sName, sFname, sLname, sPassword,sGroup)' Sub AddGroup(sGroupName) - Not used in this example.' Function GetGroupID(sGroup)' Function GetGroupList()'' Functions the build SOAP/QMWise requests' Function StartRequest(sFunction)' Function AddRequestParameter(sParamName,sParamValue)' Function PostRequest(bRet)' Function QMWISERequest(sFunction, sParamName, sParamValue)'' Perception users are free to use or modify this code as the basis of their own ' software to call QMWISe. No warranty or support is provided.'

'Setup the URL's need for the SOAP requests. This example assumes the QMWise service is runnign on the same domain as this webshareBASE_URL = Request.ServerVariables("SERVER_NAME") ' "localhost"END_POINT_URL = "http://" & BASE_URL & "/qmwise5/qmwise.asmx" 'Make sure the QMWISe webshare is correct for your installationWRAPPER_ELEMENT_NAMESPACE = "http://" & BASE_URL & "/QMWISe/"BASE_SOAP_ACTION_URI = "http://questionmark.com/QMWISe/"'-------------------------------------------------------------%><html><head><title>QMWise ASP Sample</title><meta http-equiv="Content-Language" content="en-us"><meta http-equiv="Content-Type" content="text/html; charset=windows-1252"></head><body bgcolor="#ffffff" text="#000000" ><hr><p>This example demonstrates how to use QMWISe to:</p><ul><li>Add a participant to the Perception Participant table</li><li>Assign a participant to a group</li><li>Provide a list of Perception groups</li></ul>

<p>This example uses the MS objects for building SOAP request. (The <A HREF="http://www.microsoft.com/downloads/details.aspx?FamilyId=C943C0DD-CEEC-4088-9753-86F052EC8450&displaylang=en" TARGET="_NEW">SOAP Toolkit</A> must be installed.) </p><ul><li>MSSOAP.SoapSerializer30</li><li>MSSOAP.HttpConnector30</li></ul><p>The MS XML DOM object is used to parse the SOAP responses</p><ul><li>Msxml2.DOMDocument</li></ul><p>Perception users are free to use or modify this code as the basis of their own software to call QMWISe. No warranty or support is provided.</p><hr><form method="post" action="qmwisesample.asp" name="sampleform">Participant Name (Participant_Name): <input type="text" name="idname" value="<%=Request.Form("idname")%>"><i>(must be unique)</i><br>First Name (First_Name): <input type="text" name="fname" value="<%=Request.Form("fname")%>"><br>Last Name (Last_Name): <input type="text" name="lname" value="<%=Request.Form("lname")%>"><br>Password (Password): <input type="text" name="password" value="<%=Request.Form("password")%>"><br>Group Name: <% GetGroupList()%><br><br><input type="submit" value="Add Participant" name="Submit">

<br> <%

If Len(Request.Form("idname")) > 0 Then Call CreateParticipant(Request.Form("idname"),Request.Form("fname"),Request.Form("lname"), Request.Form("password"),Request.Form("groupname"))End If

if Len(xmlObj.text) > 0 Then 'We've set the PostRequest function up to return an empty xml set if the function receives a faultResponse.Write "<br>Added Participant with ID of:<b> " & xmlObj.text & "</b>"

End Function'' Add a parameter to the SOAP request, use this function for simple parameters, if you need ' to send complex parameters this function should not be used.'Function AddRequestParameter(sParamName,sParamValue)' Response.Write sParamNameIf Len(sParamName) > 0 Theng_Serializer.startElement sParamName, BASE_SOAP_ACTION_URIg_Serializer.writeString sParamValueg_Serializer.endElementEnd IfEnd Function''Submit the SOAP request to the QMWise service and return the response' if the call fails, this function returns an empty xml stream'' set bRet = True to return a value'Function PostRequest(bRet)