Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim webClient As HttpClient
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim btnLogin As Button
Dim pnlDM As Panel
Dim webRequest As HttpRequest
Dim lblLoginStatus As Label
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("MainScreen")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub btnLogin_Click
Dim endPoint As String
Dim requestSoapXML As String
Dim resultSoapXML As String
Dim userName, password As String
userName = "Login1"
password = "password1"
endPoint = "http://servername:8080/test/Test/"
requestSoapXML = _
"<soapenv:Envelope xmlns:soapenv=" & QUOTE & "http://schemas.xmlsoap.org/soap/envelope/" & QUOTE & " xmlns:urn=" & QUOTE & "urn:System:System" & QUOTE & ">" & _
"<soapenv:Header/>" & _
"<soapenv:Body>" & _
"<urn:login>" & _
"<urn:Login>"& userName & "</urn:Login>" & _
"<urn:password>"& password & "</urn:password>" & _
" </urn:login>" & _
"</soapenv:Body>" & _
"</soapenv:Envelope>"
Log(requestSoapXML )
webRequest.InitializePost2(endPoint, requestSoapXML .GetBytes("UTF8"))
webRequest.Timeout = 10000
webRequest.SetHeader("Content-Type", "text/xml; charset=utf-8")
webRequest.SetHeader("SOAPAction", "")
webClient.Initialize("webClient")
If webClient.Execute(webRequest, 1) = False Then Return
End Sub
Sub webClient_ResponseSuccess (Response As HttpResponse, TaskId As Int)
Dim resultSoapXML As String
resultSoapXML = Response.GetString("UTF8")
lblLoginStatus.Text = resultSoapXML
Log("Success : " & resultSoapXML)
End Sub
Sub webClient_ResponseError (Response As HttpResponse, Reason As String, StatusCode As Int, TaskId As Int)
Dim resultSoapXML As String
resultSoapXML = Response.GetString("UTF8")
lblLoginStatus.Text = resultSoapXML
Log("Error : " & resultSoapXML)
Log("Reason: " & Reason)
Log("StatusCode: " & StatusCode)
End Sub