dcsimg
Results 1 to 6 of 6

Thread: call PostString would not return the result

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Oct 2018
    Posts
    22

    Question call PostString would not return the result

    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

  2. #2
    Junior Member
    Join Date
    Dec 2010
    Posts
    24

    Re: call PostString would not return the result

    You are missing the JobDone event handler. Simplest example:
    Code:
    Dim j As HttpJob
    j.Initialize("", Me)
    j.Download("https://www.google.com")
    Wait For (j) JobDone(j As HttpJob)
    If j.Success Then
       Log(j.GetString)
    End If
    j.Release

    https://www.b4x.com/android/forum/th...79345/#content

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Oct 2018
    Posts
    22

    Re: call PostString would not return the result

    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());

    }

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Oct 2018
    Posts
    22

    Question Re: call PostString would not return the result

    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());

    }

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Oct 2018
    Posts
    22

    Re: call PostString would not return the result

    also do this:

    a = job1.Download("mywebservive/MYServices2.asmx/HelloWorld")
    'Msgbox("titr",a)

    Wait For (job1) JobDone(job1 As HttpJob)
    If job1.Success Then
    Msgbox("titr",a)
    End If
    job1.Release

    but a is also empty

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Oct 2018
    Posts
    22

    Question Re: call PostString would not return the result

    also do this:

    a = job1.Download("mywebservive/MYServices2.asmx/HelloWorld")
    'Msgbox("titr",a)

    Wait For (job1) JobDone(job1 As HttpJob)
    If job1.Success Then
    Msgbox("titr",a)
    End If
    job1.Release

    but a is also empty

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width