Android Question Webservice to Login

MoscovoPT

Member
Hi.

Would like some help with my webservice.
I've followed the video tutorial about it but got an error while connecting.
Any ideia of what could be? Have read other topics but coudn't find any answer to solve the issue.
Also add HU2_ACCEPTALL to Conditional Symbols in Build Configurations to accept all connections but no result at all too.

Error Log:
ResponseError. Reason: java.net.ConnectException: Failed to connect to /XX.XXX.XXX.XXX:80, Response:

Thanks in advance.

Webservice to Login:
#Region  Project Attributes
    #ApplicationLabel: TRails Portugal
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: portrait
    #CanInstallToExternalStorage: False
#End Region

#Region  Activity Attributes
    #FullScreen: True
    #IncludeTitle: True
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Private xui As XUI
   

End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("Main")
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub Button1_Click
   
    Check("John", "11111")
    StartActivity("Index")
   
End Sub

Sub Check(username As String, password As String)

    Dim XML As String
    XML=""
    XML = XML & "<?xml version='1.0' encoding='utf-8'?>"
    XML = XML & "<soap12:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap12='http://www.w3.org/2003/05/soap-envelope'>"
    XML = XML & "<soap:Body>"
    XML = XML & "<CheckUser xmlns='http://75.119.136.162/WebServiceGeral/WebServiceGeral.asmx'>"
    XML = XML & "<username>"& username &"</username>"
    XML = XML & "<password>"& password &"</password>"
    XML = XML & "</CheckUser>"
    XML = XML & "</soap:Body>"
    XML = XML & "</soap:Envelope>"
   
    Dim ResultURL As String
    Dim j As HttpJob
    j.Initialize("",Me)
    j.PostString("http://XX.XXX.XXX.XXX/WebServiceGeral/WebServiceGeral.asmx",XML)
    j.GetRequest.SetContentType("text/xml; charset=utf-8")
    j.GetRequest.SetHeader("SOAPAction","'http://XX.XXX.XXX.XXX/WebServiceGeral/WebServiceGeral.asmx/CheckUser'")
   

    Wait For (j) JobDone(j As HttpJob)
    If j.Success Then
        ResultURL = j.GetString
    Else
        ResultURL = j.ErrorMessage
    End If
    j.Release
   
End Sub
 

MoscovoPT

Member
Hi Erel/Community

Error is this:

ResponseError. Reason: java.net.ConnectException: Failed to connect to /XX.XXX.XXX.XXX:80, Response:

1630318838203.png


Line added to the manifest although still not working... Error is the same as before.

1630318900687.png


Thank you for you help and support.
 

Attachments

  • 1630318758386.png
    1630318758386.png
    62.2 KB · Views: 237
  • 1630318796251.png
    1630318796251.png
    63.6 KB · Views: 232
Upvote 0

MoscovoPT

Member
Hi,

In fact I have - this PC is from the company - but have allowed all connections through the Firewall/Anti-Virus.
The App is running under Android Emulator. I have other Apps coded with Flutter and the calls to the webservice have success under Android Emulator too.

Thank you.
BR
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
B4X:
#Region  Project Attributes
    #ApplicationLabel: TRails Portugal
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: portrait
    #CanInstallToExternalStorage: False
#End Region

#Region  Activity Attributes
    #FullScreen: True
    #IncludeTitle: True
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Private xui As XUI
End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("Main")
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub Button1_Click
  
    Check("John", "11111")
    'StartActivity("Index")
  
End Sub

Sub Check(username As String, password As String)

    Dim XML As String
'    XML=""
'    XML = XML & "<?xml version='1.0' encoding='utf-8'?>"
'    XML = XML & "<soap12:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap12='http://www.w3.org/2003/05/soap-envelope'>"
'    XML = XML & "<soap:Body>"
'    XML = XML & "<CheckUser xmlns='http://75.119.136.162/WebServiceGeral/WebServiceGeral.asmx'>"
'    XML = XML & "<username>"& username &"</username>"
'    XML = XML & "<password>"& password &"</password>"
'    XML = XML & "</CheckUser>"
'    XML = XML & "</soap:Body>"
'    XML = XML & "</soap:Envelope>"
  
    XML = $"<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <CheckUser xmlns="http://75.119.136.162/WebServiceGeral/WebServiceGeral.asmx">
      <username>${username}</username>
      <password>${password}</password>
    </CheckUser>
  </soap:Body>
</soap:Envelope>"$
    Dim ResultURL As String
    Dim j As HttpJob
    j.Initialize("",Me)
    'j.PostString("http://XX.XXX.XXX.XXX/WebServiceGeral/WebServiceGeral.asmx",XML)
    'j.GetRequest.SetContentType("text/xml; charset=utf-8")
    'j.GetRequest.SetHeader("SOAPAction","'http://XX.XXX.XXX.XXX/WebServiceGeral/WebServiceGeral.asmx/CheckUser'")
    
    j.PostString("http://75.119.136.162/WebServiceGeral/WebServiceGeral.asmx", XML)
    j.GetRequest.SetContentType("text/xml; charset=utf-8")

    Wait For (j) JobDone(j As HttpJob)
    If j.Success Then
        ResultURL = j.GetString
        Log(ResultURL)
        StartActivity(Index)
    Else
        'ResultURL = j.ErrorMessage
        Log(j.ErrorMessage)
    End If
    j.Release
End Sub
 
Upvote 0
Top