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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:53:27+00:00 2026-05-25T21:53:27+00:00

in my code i am sending the json data like this ByteArrayOutputStream baos =

  • 0

in my code i am sending the json data like this

ByteArrayOutputStream baos = new ByteArrayOutputStream();
                        imgbmp.compress(Bitmap.CompressFormat.PNG, 90, baos);
                        byte[] b = baos.toByteArray();
                        String encodedImage = Base64.encodeBytes(b);
                        jsonstr = new JSONStringer().object().key("Text")
                                .value(msg).key("Files").array().object().key(
                                        "ContentType").value("image/png").key(
                                        "Content").value(encodedImage)
                                .endObject().endArray().key("AuthToken").value(token)
                                .endObject();

StringEntity entity = new StringEntity(jsonstr.toString());
                    entity.setContentType("application/json;charset=UTF-8");
                    entity.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE,"application/json;charset=UTF-8"));
                    request.setEntity(entity);
                    DefaultHttpClient httpClient = new DefaultHttpClient();

                    HttpResponse res = httpClient.execute(request);

and i am getting this error while executing the HttpClient

09-30 11:56:21.571: INFO/Request(22161): org.apache.http.client.methods.HttpPost@468613b0
09-30 11:56:21.586: INFO/JSON ANS(22161): <Fault xmlns="http://schemas.microsoft.com/ws/2005/05/envelope/none"><Code><Value>Receiver</Value><Subcode><Value xmlns:a="http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher">a:InternalServiceFault</Value></Subcode></Code><Reason><Text xml:lang="en-US">The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or a non-white space character among the padding characters. </Text></Reason><Detail><ExceptionDetail xmlns="http://schemas.datacontract.org/2004/07/System.ServiceModel" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><HelpLink i:nil="true"/><InnerException i:nil="true"/><Message>The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or a non-white space character among the padding characters. </Message><StackTrace>   at System.Convert.FromBase64String(String s)&#xD;
09-30 11:56:21.586: INFO/JSON ANS(22161):    at Zoodig.Core.WebServices.DataContracts.FileContract.GetStream()&#xD;
09-30 11:56:21.586: INFO/JSON ANS(22161):    at Zoodig.WebServices.Services.AthletesService.PostUpdate(PostUpdateContract data)&#xD;
09-30 11:56:21.586: INFO/JSON ANS(22161):    at SyncInvokePostUpdate(Object , Object[] , Object[] )&#xD;
09-30 11:56:21.586: INFO/JSON ANS(22161):    at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]&amp; outputs)&#xD;
09-30 11:56:21.586: INFO/JSON ANS(22161):    at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc&amp; rpc)&#xD;
09-30 11:56:21.586: INFO/JSON ANS(22161):    at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc&amp; rpc)&#xD;
09-30 11:56:21.586: INFO/JSON ANS(22161):    at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41(MessageRpc&amp; rpc)&#xD;
09-30 11:56:21.586: INFO/JSON ANS(22161):    at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc&amp; rpc)&#xD;
09-30 11:56:21.586: INFO/JSON ANS(22161):    at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc&amp; rpc)&#xD;
09-30 11:56:21.586: INFO/JSON ANS(22161):    at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc&amp; rpc)&#xD;
09-30 11:56:21.586: INFO/JSON ANS(22161):    at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc&amp; rpc)&#xD;
09-30 11:56:21.586: INFO/JSON ANS(22161):    at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc&amp; rpc)&#xD;
09-30 11:56:21.586: INFO/JSON ANS(22161):    at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc&amp; rpc)&#xD;
09-30 11:56:21.586: INFO/JSON ANS(22161):    at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)</StackTrace><Type>System.FormatException</Type></ExceptionDetail></Detail></Fault>

Please if anyone can understand this and tell me whats happening here..where are the posibilities that i have made any mistakes..and why i am getting the error?

Thank You.
MKJParekh

  • 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-25T21:53:27+00:00Added an answer on May 25, 2026 at 9:53 pm

    i got the answer…
    i was not making any kind of mistakes

    that was problem with org.json

    i switched to another..and all it works

    nesting too deep in JSON… should I switch to XML?

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

Sidebar

Related Questions

i have this code for sending data var test={imagename:apple.jpg,x:13,y:33}; $.ajax({ type: POST, url: some.php,
this way i am sending my json data this way i construct my json
I am sending data to a server using below code: HttpClient httpclient = new
I'm logging errors and sending myself the exception logs! Like the following code private
Possible Duplicate: Sending and Parsing JSON in Android I am fetching JSON Data from
I have this code just to send data from already loaded jqGrid: jQuery(#bedata).click(function(){ //Function
I have created a code like this to access method AddNums in my webservice.
How can I garble JavaScript code before sending it to client-side? I don't want
using the Code Snippet for sending email in VB.Net I have successfully sent an
M sending the parameters from the jsp page, the code is <s:url id=url action=searchAction>

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.