WSDL Webservice logon problem...

Hodi

Member
Licensed User
Longtime User
Hi All,


I want to send a request to our WSDL Service but I´m not sure If I have to logon before I send the XML request because in the request I send the Authorization with the user/Password as Base24 code,too.

My code is the following:

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 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


endPoint = "http://xx.xxx.xx.xx:xxxx/sap/bc/srt/rfc/sap/TEST?sap-client=100"

requestSoapXML = _
"<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:urn='urn:sap-com:document:sap:rfc:functions'>" & _
" <soapenv:Header/>"& _
" <soapenv:Body>"& _
" <ET_LTAP_CONF>"& _
" <!--Zero or more repetitions:-->"& _
" </ET_LTAP_CONF>"& _
" <IV_LGNUM>100</IV_LGNUM>"& _
" <IV_TANUM>821</IV_TANUM>"& _
" </urn:Z_TASS_MOBILE_MM_TO_CONFIRM>"& _
" </soapenv:Body>"& _
"</soapenv:Envelope>"

Log(requestSoapXML )

webRequest.InitializePost2(endPoint, requestSoapXML .GetBytes("UTF8"))
webRequest.SetHeader("POST", "/sap/bc/srt/rfc/sap/TEST?sap-client=100 HTTP/1.1")
webRequest.SetHeader("Accept-Encoding", "gzip,deflate")
webRequest.SetHeader("Content-Type", "text/xml; charset=utf-8")
webRequest.SetHeader("SOAPAction", "")
webRequest.SetHeader("User-Agent", "Jakarta Commons-HttpClient/3.1")
webRequest.SetHeader("Content-Length", "1496")
webRequest.SetHeader("Authorization", "VXNlcjpQYXNzd29yZA==")
webRequest.SetHeader("Host", "xx.xxx.xx.xx:xxxx")
webRequest.SetHeader("Cookie", "$Version=0; sap-usercontext=sap-client=100; $Path=/")
webRequest.Timeout = 10000

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


I get the result : Connection to xx.... refused!


Has everyone worked with a WSDL Service like that?
(Last information: when I open the address with my browser I get a Dialoge box to type in the user/password - but I think that is should be enough to send the Login data inside the xml request - is this true?)

Thanks in advance,
Hodi
 
Last edited:
Top