Ok, so step by step:
1. Login with RQL
<IODATA>
<ADMINISTRATION action='login' name='admin' password='admin'/>
</IODATA>
1a. If user is not logged in yet or not all sessions are used, you'll
get
<IODATA>
<LOGIN guid="[!guid_login!]" server="MyServer"
serverguid="[!guid_server!]" userkey="[!key_user!]"
usertoken="[!key_token!]"/>
<USER guid="[!guid_user!]" name="admin" fullname="Admin" id="1"
flags1="0" flags2="32768" dialoglanguageid="DEU"
dialogtextdirection="" languageid="DEU" showstarthelp="0"
lcid="1031"
navigationtype="0" preferrededitor="0" invertdirectedit="0">
...
</USER>
</IODATA>
1b. If user is already logged in, you'll get
<IODATA>
<LOGINS>
<LOGIN guid="[!guid_login!]" loginguid="[!guid_login!]"
userguid="[!guid_user!]" lastdate="38562,6545023148"
lastactiondate="38562,6545023148" logindate="38562,6545023148"
intern="0" moduledescription=""/>
...
</LOGINS>
<USER guid="" id="0" flags1="0" flags2="0" dialoglanguageid="DEU"
dialogtextdirection="" languageid="" isservermanager="0"
showstarthelp="0"
lcid="1031"/>
</IODATA>
2. From both 1a and 1b grab the login guid: from <LOGIN guid="[!
guid_login!]"
Additionally, if 1b with RDError101, do a LogOut of the user and
Login again, so you end up with 1a.
3. Get the session with the login guid from 1a with RQL:
<IODATA loginguid="[!guid_login!]">
<ADMINISTRATION action="validate" guid="[!guid_login!]"
useragent="script">
<PROJECT guid="[!guid_project!]"/>
</ADMINISTRATION>
</IODATA>
Answere from server is
<IODATA>
<PROJECT guid="[!guid_project!]" name="project_name"
reddotstartpageguid="" flags="1" versioning="-1" testproject="0"
useexterneditor="0" externeditorurl="" requestexterneditortext=""
setnamesonlyinmainlanguage="0" rdeditorpreferred="0"
templaterelease="0" contentclassversioning="2"
wordeditorallowed="0"
liveserverguid="[!guid_liveserver!]" donotloadtexteditorinform="0"
mainlanguagevariantid="DEU" navigationmanager="1"/>
<USER guid="[!guid_user!]" userid="1" maxlevel="1"
isservermanager="-1" dialoglanguageid="DEU"
projectguid="[!guid_project!]" lm="-1" languagevariantid="DEU"
country="Germany" language="German" languagekey="ge"
lcid="1031" dialoglcid="1031" languagevariantlcid="1031"
rights1="-1" rights2="-1" rights3="-1" rights4="-1"
flags1="1040408"
flags2="15948"/>
<SERVER guid="[!guid_server!]" name="" key="[!key!]"/>
<LICENSE userguid="[!guid_user!]" projectguid="[!guid_project!]"
guid="[!guid_license!]" level="1" te="-1" lm="-1" id="smarttree"/
>
</IODATA>
Grab the session key from <SERVER ... key="xxxxx"
The function I posted before needs to be adjusted for your script.
A full working script could look like this:
strProjectGUID = "4DEF650A380D4218B915374023D35DB3"
sWSDLUrl = "
http://192.168.50.50/cms/WebService/RDCMSXMLServer.WSDL"
strLoginUser = "admin"
strLoginPass = "admin"
Dim sRQLResponse, sError, sInfo
Dim strLoginGUID, strSessionKey, strUserGUID
Dim objXMLDOM, oSoapClient
Set objXMLDOM=Server.CreateObject("Microsoft.XMLDOM")
'Init the client to call the RedDot CMS WebService
Set oSoapClient = CreateObject("MSSOAP.SoapClient30")
oSoapClient.ClientProperty("ServerHTTPRequest") = True
oSoapClient.MSSoapInit2 sWSDLUrl, "", "", "", ""
Public Function SendRQLRequest(sRQLRequest)
'Execute the RQL and receive the response
sRQLResponse = oSoapClient.Execute(sRQLRequest, sError, sInfo)
Call objXMLDOM.LoadXML(sRQLResponse)
Set SendRQLRequest = objXMLDOM
End Function
Public Function GetLoginGuid(strLoginUser,strLoginPass)
sRQLRequest = "<IODATA><ADMINISTRATION action='login' name='" &
strLoginUser & "' password='" & strLoginPass & "'/></IODATA>"
Set oRQLResponse = SendRQLRequest(sRQLRequest)
Set oNode = oRQLResponse.selectSingleNode("//LOGIN")
If oNode Is Nothing Then
Response.Write "ERROR: No LoginGUID found..."
Exit Function
End If
strLoginGUID = oNode.GetAttribute("guid")
If (sError="#RDError101") Then
Call LogOut(strLoginGUID)
Call GetLoginGuid(strLoginUser,strLoginPass)
End If
GetLoginGuid = strLoginGUID
Set oRQLResponse = Nothing
Set oNode = Nothing
End Function
Public Function GetSessionKey(strLoginGUID, strProjectGUID)
sRQLRequest = "<IODATA loginguid='" & strLoginGUID &
"'><ADMINISTRATION action='validate' guid='" & strLoginGUID &
"'><PROJECT guid='" & strProjectGUID & "' /></ADMINISTRATION></
IODATA>"
Set oRQLResponse = SendRQLRequest(sRQLRequest)
Set oNode = objXMLDOM.SelectSingleNode("//SERVER")
If oNode Is Nothing Then
Response.Write "ERROR: No SessionKey found..."
Exit Function
End If
GetSessionKey = oNode.GetAttribute("key")
Set oRQLResponse = Nothing
Set oNode = Nothing
End Function
Public Function GetUserGuid(strSessionKey)
sRQLRequest = "<IODATA><PROJECT sessionkey='" & strSessionKey &
"'><USER action='sessioninfo'/></PROJECT></IODATA>"
Set oRQLResponse = SendRQLRequest(sRQLRequest)
Set oNode = objXMLDOM.SelectSingleNode("//USER")
If oNode Is Nothing Then
Response.Write "ERROR: No User found..."
Exit Function
End If
GetUserGuid = oNode.GetAttribute("guid")
End Function
Public Function LogIn(strLoginUser,strLoginPass)
strLoginGUID = GetLoginGuid(strLoginUser,strLoginPass)
strSessionKey = GetSessionKey(strLoginGUID, strProjectGUID)
strUserGUID = GetUserGuid(strSessionKey)
If (strLoginGUID <> "" AND strSessionKey <> "" AND strUserGUID <>
"" ) Then
LogIn = True
Else
LogIn = False
End If
End Function
Public Function LogOut(strLoginGUID)
sRQLRequest = "<IODATA loginguid='" & strLoginGUID &
"'><ADMINISTRATION><LOGOUT guid='" & strLoginGUID & "' /></
ADMINISTRATION></IODATA>"
Set oRQLResponse = SendRQLRequest(sRQLRequest)
LogOut = sRQLResponse
Set oRQLResponse = Nothing
End Function
Call LogIn(strLoginUser,strLoginPass)
'Do whatever you want to do with the script here
Call LogOut(strLoginGUID)
Best-
alex