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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:43:23+00:00 2026-05-24T09:43:23+00:00

In my application I’m using outpost method to send data to web service which

  • 0

In my application I’m using outpost method to send data to web service which is in .net.Now when i send string with spaces or special characters it takes the string with e.g. test string would display like test+string.

I’m using httpDefaultClient with nameValuePair to send data…i’ve used UrlEncode function to encode my string but still result is the same…
Please help me…

Here is my code

//web service call
                HttpClient client=new DefaultHttpClient();
                HttpPost request = new HttpPost();
                request.setURI(new URI(url2));

                List<NameValuePair> nameValuePairs=new ArrayList<NameValuePair>();
                //  nameValuePairs.add(new BasicNameValuePair("CreateHotSpots", value))
                nameValuePairs.add(new BasicNameValuePair("sKey",""+globalClass.getUser_key()));
                nameValuePairs.add(new BasicNameValuePair("sLAKE",encodedlakename));
                if(!(DragAndDropPinActivity.point.isEmpty())){
                    nameValuePairs.add(new BasicNameValuePair("sLAT",""+DragAndDropPinActivity.point.get(0)));
                    nameValuePairs.add(new BasicNameValuePair("sLon",""+DragAndDropPinActivity.point.get(1)));

                }
                else
                {
                    url2=url2.concat("&sLAT="+""+myLatitude);
                    url2=url2.concat("&sLon="+""+myLongitude);

                }

                nameValuePairs.add(new BasicNameValuePair("sDesc",encodedDesc));
                nameValuePairs.add(new BasicNameValuePair("sSpeciesofFish",encodedFishSpecies));
                nameValuePairs.add(new BasicNameValuePair("sBaitUsed",encodedbUsed));
                nameValuePairs.add(new BasicNameValuePair("sWeatherInformation",encodedwInfo));
                nameValuePairs.add(new BasicNameValuePair("season",encodedlseason));
                nameValuePairs.add(new BasicNameValuePair("sDesc",""+encodedDesc));
                if(share)
                {
                    nameValuePairs.add(new BasicNameValuePair("sShareInfo","true"));
                }
                else
                {
                    nameValuePairs.add(new BasicNameValuePair("sShareInfo","false"));
                }

                Log.e("name value pairs",""+nameValuePairs.toString());
                UrlEncodedFormEntity entity_st=new UrlEncodedFormEntity(nameValuePairs,"UTF-8");
                request.setEntity(entity_st);

                HttpResponse response = client.execute(request);
                HttpEntity resEntity = response.getEntity();  
                if (resEntity != null) { 

                    Responce=EntityUtils.toString(resEntity);
                    Log.i("responce ======",""+Responce);

                }

            }
            catch (Exception e) {
                e.printStackTrace();
                String message=e.getMessage();
                Log.e("meaasge with erroe",message);
            }

            return Responce;
        }
  • 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-24T09:43:24+00:00Added an answer on May 24, 2026 at 9:43 am

    step 1

    You have specified a “UTF-8” encoding in

    UrlEncodedFormEntity entity_st=new UrlEncodedFormEntity(nameValuePairs,"UTF-8"); 
    

    Try to change it to

    UrlEncodedFormEntity entity_st=new UrlEncodedFormEntity(nameValuePairs); 
    

    step 2

    I noticed that the strings you are adding to the request are called encodeXXXX

    Does this mean that you are encoding them before adding them to the ValuePairs?

    If so, stop doing this and keep them as normal strings.

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

Sidebar

Related Questions

Our application has a lot of .NET assemblies, which up until now, has not
Application db connection in web service. i haveto connect the db using that web
Application configuration: Web application using java first method of creating JAX-WS 2.0 Web Services
Application is asp.net MVC. I want to put a textbox for date using mask.
Application is a C# .Net 3.5 WCF Service. I'd like during the build process
Application pool for my web service has Identity set to myDomain\myUser. When I run
Application frameworks such as DotNetNuke, Eclipse, Websphere and so forth are available today which
Application stores configuration data in custom section of configuration file. This information is used
Application : I am working on one mid-large size application which will be used
My application (.net 3.5 sp1) uses the HttpWebRequest to communicate with different endpoints, sometimes

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.