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 6925971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:51:30+00:00 2026-05-27T10:51:30+00:00

I’m trying to send a JSON string, from an Android 2.3 application, using Java

  • 0

I’m trying to send a JSON string, from an Android 2.3 application, using Java 1.5, converted into a byte[] to an ASP.NET WebService method that is waiting for a POST Base64Binary stream.

Here is my Java code to encode the JSON string :

String encoded = Base64.encodeToString(me.getValue().getBytes(), Base64.DEFAULT);

me is my JSON string.

Here is the error I’m getting from ASP.NET :

System.ArgumentException: Cannot convert eyJJZEV0YXRJbnNwZWN0aW9uIjoiMSIsIkFwcGxpY2FibGUiOiJUcnVlIiwiSWRFdGF0IjoiMSIsIklkVGFzayI6IjczOCIsIkRhdGVEZXJuaWVyTW9kaWYiOiIyMDExLTEyLTA5IDIwOjA5OjIyIiwiSWRDb250cmF0IjoiMzg1NTYiLCJJZFRhc2tDb250cmF0IjoiNDc5ODExMSJ9 to System.Byte.
 Parameter name: type ---> System.FormatException: Input string was not in a correct format.
    at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
    at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
    at System.Byte.Parse(String s, NumberStyles style, NumberFormatInfo info)
    at System.String.System.IConvertible.ToByte(IFormatProvider provider)
    at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
    at System.Web.Services.Protocols.ScalarFormatter.FromString(String value, Type type)
    --- End of inner exception stack trace ---
    at System.Web.Services.Protocols.ScalarFormatter.FromString(String value, Type type)
    at System.Web.Services.Protocols.ValueCollectionParameterReader.Read(NameValueCollection collection)
    at System.Web.Services.Protocols.HtmlFormParameterReader.Read(HttpRequest request)
    at System.Web.Services.Protocols.HttpServerProtocol.ReadParameters()
    at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()

Any idea why I’m getting this error (I can’t control the .NET side) ?

Thanks!
Nicolas.

  • 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-27T10:51:31+00:00Added an answer on May 27, 2026 at 10:51 am

    I faced a similar problem before. I had implemented a code on Android to do SHA-1 hashing using Base64.

    I was also doing SHA-1 hashing on server side in my web service method in .NET

    Here is what my server side code looks like (.asmx web service)

       public class Service1 : System.Web.Services.WebService
          { 
                [WebMethod]
              public string HashCode(string str)
           {
              string rethash = "";
           try
             {
    
            System.Security.Cryptography.SHA1 hash = System.Security.Cryptography.SHA1.Create();
            System.Text.ASCIIEncoding encoder = new System.Text.ASCIIEncoding();
            byte[] combined = encoder.GetBytes(str);
            hash.ComputeHash(combined);
            rethash = Convert.ToBase64String(hash.Hash);
              }
          catch (Exception ex)
            {
            string strerr = "Error in HashCode : " + ex.Message;
            }
        return rethash;
         }
      }
    

    This worked for me and I could compute the hash of my byte array properly.

    Hope this gives you some idea,

    Cheers

    All the best

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I am currently running into a problem where an element is coming back from
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I have thousands of HTML files to process using Groovy/Java and I need to
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure

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.