Android Question call PostString would not return the result

armm1388

Member
hello
i write a web service and upload it in my host. its show a string which is count of online users of site. it works fine and in my websites it test it.
now in B4A, I WANTS TO call this process. but it don't work.

Dim job1 As HttpJob ' in sub global

job1.Initialize("OnlineUsers",Me)
job1.JobName ="OnlineUsers"
job1.PostString("mywebservive/MYServices2.asmx/OnlineUsers_Counts","OnlineUsers")


thanks
 

DonManfred

Expert
Licensed User
Longtime User
1. Please use [CODE]code here...[/CODE] tags when posting code.





it works fine and in my websites it test it.
What does work? How are you calling the working one? Post the code which is working (may be written in another Language). But we can not guess what is working for your, how the WS is defined....

Are you sure you need to use POST?

Can you post a URL which is working/returning the result?
It is possible that you just need to use Download or Download2 to get the results. Hard to say whitout knowing the WS Documentation.
 
Upvote 0

armm1388

Member
hello and thanks for your attention to me.
may be i must use from another commands instead of PostString.
is it right? where command i must use for run my webservice? (a function in webservice).

here is code in web service.
[WebMethod]
public void OnlineUsers_Counts()
{
DataTable dt = new DataTable();
SqlCommand GetServiceNumCMD = new SqlCommand();
GetServiceNumCMD.CommandText = "select count(*) from t_OnlineUsers ";

// if ((con.State == ConnectionState.Open) && con.State == ConnectionState.Broken)

con.Close();
con.Open();

GetServiceNumCMD.Connection = con;

var RowCount = GetServiceNumCMD.ExecuteScalar();

Context.Response.Write(RowCount.ToString());

}
 
Upvote 0

armm1388

Member
yes . i call this webservice from a browser. it run fine.
but how should i call it in a b4a program?

Dim job1 As HttpJob ' in sub global

job1.Initialize("OnlineUsers",Me)
job1.JobName ="OnlineUsers"
job1.PostString("mywebservive/MYServices2.asmx/OnlineUsers_Counts","OnlineUsers")

what i miss in above commands?
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…