Android Question How to Call WebService

junaidahmed

Well-Known Member
Licensed User
Longtime User
I have created below webservice in .asmx format.but when i execute this service using "HttpJob",it returns as "Internal Server Error".Please check below code and advise how to do that...

WebService:-

[WebMethod(Description = "EmpDet")]
public DataSet GetEmpDetails(string StrEmpCode)
{
DataSet dataset = new DataSet();
dataset = Db.SetCommand("Select M.EmpName,D.deptname Department from Arind.Dbo.HrEmpMas M Join Arind.Dbo.Department D On D.DeptCode = M.deptcode Where (M.EmpCode = '" + StrEmpCode + "') And (M.OnRolls = 'Y') ").ExecuteDataSet();
Db.Close();
Db.Dispose();
return dataset;
}

Basic4Android:-

Dim job1 As HttpJob
job1.Initialize("Job1", Me)
job1.PostString("http://103.76.188.138:85/StageEntry/StageEntry.asmx/GetEmpDetails","StrEmpCode=4550")

Sub JobDone (Job As HttpJob)

Log("JobName = " & Job.JobName & ", Success = " & Job.Success)

If Job.Success = True Then

Msgbox(Job.GetString,"")
Log(Job.GetString)

Else
Log("Error: " & Job.ErrorMessage)
ToastMessageShow("Error: " & Job.ErrorMessage, True)
End If
Job.Release
 

DonManfred

Expert
Licensed User
Longtime User
It is a SOAP request, right?
Yes
POST /StageEntry/StageEntry.asmx HTTP/1.1
Host: 103.76.188.138
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/GetEmpDetails"

<?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>
<GetEmpDetails xmlns="http://tempuri.org/">
<StrEmpCode>string</StrEmpCode>
</GetEmpDetails>
</soap:Body>
</soap:Envelope>

See http://103.76.188.138:85/StageEntry/StageEntry.asmx for more info about the endpoint.
 
Upvote 0

junaidahmed

Well-Known Member
Licensed User
Longtime User
In windows CE (Smart Device application), we can add web reference to call Web Service...

Is there any option for such kind in "Basic4Android" ???
 
Upvote 0
Top