Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6146627
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:58:41+00:00 2026-05-23T18:58:41+00:00

I am trying to post data to my server (vb.net) using mobile devices. I’ve

  • 0

I am trying to post data to my server (vb.net) using mobile devices.
I’ve researched several great articles on the client-side (Android) including this Encosia article and sending JSON object with Android.

I have created a sample class:

Public Class OneEvaluation

   Private strEmail As String
    Public Property email() As String
        Get
            Return strEmail
        End Get
        Set(ByVal value As String)
            strEmail = value
        End Set
    End Property
    Private strPassword As String
    Public Property password() As String
        Get
            Return strPassword
        End Get
        Set(ByVal value As String)
            strPassword = value
        End Set
    End Property
End Class

and I’ve created my webmethod:

Public Class AsmxCodebehind
    Inherits System.Web.Services.WebService

<WebMethod()> _
   Public Function AndroidTest(ByVal JSON As OneEvaluation) As String  '
    Dim strSQLInsertCommand As String

    ' code block

    Return "whatever"
End Function

It builds (VS2008 sp1) with no errors. I get no response on the android.
If I delete the argument ‘JSON as OneEvaluation’, it will successfully post in a browser and provide a HTML return; but as coded above… the error is:

System.InvalidOperationException: AndroidTest Web Service method name is not valid.
at System.Web.Services.Protocols.HttpServerProtocol.Initialize()

FYI, my Android snippet follows:

final String URL = "http://www3.myurl.com/JSON/service.asmx/AndroidTest"

HttpClient client = new DefaultHttpClient();
HttpConnectionParams.setConnectionTimeout(client.getParams(), 10000); //Timeout Limit
HttpResponse response;
JSONObject json = new JSONObject();

try{
    HttpPost post = new HttpPost(URL);
    json.put("email", email);
    json.put("password", pwd);
    StringEntity se = new StringEntity( "OneEvaluation: " + json.toString());  
    //   post.setEntity(se);
    post.setHeader("Accept", "application/json");
    post.setHeader("Content-type", "application/json; charset=utf-8");
    // se.setContentEncoding((Header) new BasicHeader(HTTP.CONTENT_TYPE, "application/json; charset=utf-8"));

    post.setEntity(new ByteArrayEntity(se.toString().getBytes("UTF8")));
    //   post.setHeader(OneEvaluation, value)
    //   ResponseHandler responseHandler = new BasicResponseHandler();
    response = client.execute(post);
    /* Checking response */
    Log.v("TAG", " JSON onItemClick fired! Position:");

    if(response!=null){
        Log.v("TAG", " Response :" + response.toString());
        //  Toast.makeText(v.getContext(), response, Toast.LENGTH_LONG);
        InputStream in = response.getEntity().getContent(); //Get the data in the entity
    }
}
catch(Exception e){
    e.printStackTrace();
    createDialog("Error", "Cannot Estabilish Connection");
    Log.v("TAG", " Cannot Estabilish Connection");
}

I haven’t seen a complete example with both server-side (except those using jQuery) and client side (especially Android). So I hope to save someone else’s weekend!

I have resisted using C# on the server side, as my other AJAX/JSON services (including those that return JSON) are in vb (and working).

I’m asking for help with the server side error… and any suggestions to clean up the Android JSON HTTP_POST.

Many Thanks in advance !

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T18:58:42+00:00Added an answer on May 23, 2026 at 6:58 pm

    Whew! I couldn’t have done it without Fiddler and some GREAT posts, like this answer from @Mark-Schultheiss.

    Also, future travelers… beware that the correct data format for your JSON is expected!

    {"JSON": {"email":"kiddin","password":"no"}} was the only way it was accepted. Single Quot is unacceptable… so escape a double quote (\”) into the code and call the methodname (ie JSON) – not the class.

    I couldn’t have done it without testing using a webpage using jQuery. I recommend this blog…
    http://encosia.com/3-mistakes-to-avoid-when-using-jquery-with-aspnet-ajax/‘> Encosia from @Dave-Ward. Just remember, I had to use double quotes rather than the mentioned single quote.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a client submitting a web-request (POST) of XML data to a server.
I am trying HTTP Post an XML string to a WebMethods server using basic
I am trying to post some data to a ASP.NET MVC Controller Action. Current
i am trying to make AJAX Call to ASP.Net Server Side Web service method
I'm tryint to post to a ADO.NET Data Service but the parameters seems to
I am trying to post some data and get some data back from a
We are trying to convert out old school client server application into a N-Tier
I'm trying to get server-side validation of an Entity Framework String Property to work.
I am having an issue trying to post a JSON string using dojo.xhrPost to
Is it possible to Post some data from window based app to a web-server

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.