Hi all,
It is my first post in this forum and I will try to be as specific as I can. I am trying to consume a .NET Web Service in my application and I am receiving an error (java.net.UknownHostException {servername.com}).
The web service definition is this:
The following is a sample SOAP 1.1 request and response. The placeholders shown need to be replaced with actual values.
POST /synproj/nikos/webservice.asmx HTTP/1.1
Host: servername.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://trial.net/CheckIfUserExist"
<?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>
<CheckIfUserExist xmlns="http://trial.net/">
<sWSUser>string</sWSUser>
</CheckIfUserExist>
</soap:Body>
</soap:Envelope>
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?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>
<CheckIfUserExistResponse xmlns="http://trial.net/">
<CheckIfUserExistResult>string</CheckIfUserExistResult>
</CheckIfUserExistResponse>
</soap:Body>
</soap:Envelope>
The post and response bellow is shown in chrome when I try to access my webservice via the internet. The host exists and is alive. I am using an Android 2.3.3 emulator.
Here is my code (the file that I read is the POST XML bellow and I change the string to the username).
I have used the OCR Examble to do so... What am I doing wrong?
It is my first post in this forum and I will try to be as specific as I can. I am trying to consume a .NET Web Service in my application and I am receiving an error (java.net.UknownHostException {servername.com}).
The web service definition is this:
The following is a sample SOAP 1.1 request and response. The placeholders shown need to be replaced with actual values.
POST /synproj/nikos/webservice.asmx HTTP/1.1
Host: servername.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://trial.net/CheckIfUserExist"
<?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>
<CheckIfUserExist xmlns="http://trial.net/">
<sWSUser>string</sWSUser>
</CheckIfUserExist>
</soap:Body>
</soap:Envelope>
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?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>
<CheckIfUserExistResponse xmlns="http://trial.net/">
<CheckIfUserExistResult>string</CheckIfUserExistResult>
</CheckIfUserExistResponse>
</soap:Body>
</soap:Envelope>
The post and response bellow is shown in chrome when I try to access my webservice via the internet. The host exists and is alive. I am using an Android 2.3.3 emulator.
Here is my code (the file that I read is the POST XML bellow and I change the string to the username).
I have used the OCR Examble to do so... What am I doing wrong?
B4X:
#Region Project Attributes
#ApplicationLabel: B4A Example
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#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.
Dim ht As HttpJob
Dim strResponse As String
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.
Private btnTry As Button
Private btnShow As Button
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
Activity.LoadLayout("Main")
End Sub
Sub JobDone(job As HttpJob)
ProgressDialogHide
'ToastMessageShow (job.JobName ,False)
If job.Success Then
ToastMessageShow("Success",False)
ToastMessageShow(job.GetString,True)
Else
ToastMessageShow("No Success", False)
ToastMessageShow(job.ErrorMessage,True)
End If
End Sub
Sub Activity_Resume
strResponse = File.GetText(File.DirAssets,"trial.txt")
strResponse = strResponse.Replace("$string$","hatzisn")
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub btnTry_Click
ht.Initialize("WS",Me)
ProgressDialogShow ("Connecting...")
ht.poststring("http://servername.com/synproj/nikos/webservice.asmx", strResponse)
ht.GetRequest.SetContentType("text/xml; charset=utf-8")
ht.GetRequest.SetHeader("SOAPAction", """http://trial.net/CheckIfUserExist""")
End Sub
Sub btnShow_Click
ToastMessageShow(strResponse,True)
End Sub