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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:30:34+00:00 2026-06-11T16:30:34+00:00

I am sending a SOAP POST that returns some xml. I’ve been testing on

  • 0

I am sending a SOAP POST that returns some xml. I’ve been testing on a newer device (Galaxy Nexus with Android 4.1) and it’s been working fine. However, I just tried running it on an older device (HTC Desire HD running Android 2.2), and I am getting a ParseException: At line 1, column 0: unclosed token. Here is the relevant code:

String xml = null;
Document doc = null;
String SOAPRequest = "[SOAP REQUEST HERE]";          

HttpPost httppost = new HttpPost("[WEBSITE HERE]");
InputStream soapResponse = null;
try {
    StringEntity postEntity = new StringEntity(SOAPRequest, HTTP.UTF_8);
    postEntity.setContentType("text/xml");
    httppost.setHeader("Content-Type", "application/soap+xml;charset=UTF-8");
    httppost.setEntity(postEntity);

    HttpClient httpclient = new DefaultHttpClient();
    BasicHttpResponse httpResponse = (BasicHttpResponse) httpclient.execute(httppost);

    // Convert HttpResponse to InputStream
    HttpEntity responseEntity = httpResponse.getEntity();
    soapResponse = responseEntity.getContent();
    //// printing response here gives me ...<Result>&lt;blahblahblah&gt;<Result>...

    // Get the SearchResult xml
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder db = factory.newDocumentBuilder();
    doc = db.parse(soapResponse);

} catch ...

NodeList soapNodeList = doc.getElementsByTagName("Result");
xml = soapNodeList.item(0).getFirstChild().getNodeValue();

//// printing xml here gives me "<" 
return xml;

Taking a look at the httpResponse, the part that I am interested in looks like this: <Result>&lt;blahblahblah&gt;</Result>.

When I try to get this xml using the NodeList, &lt;blahblahblah&gl; turns into just the character <.

Why is this a problem, and how do I fix it?

  • 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-06-11T16:30:35+00:00Added an answer on June 11, 2026 at 4:30 pm

    This could be relevant:

    android DOM parsing with entities in tags

    …which leads to this:

    http://code.google.com/p/android/issues/detail?id=2607

    …which seems to indicate that on earlier Android versions the DOM parser doesn’t deal with entity references properly. The bug report there discusses something about how entities are treated as a separate child rather than merged into the adjacent text node(s) which sounds oddly like your situation.

    If this is the problem you’re having then try switching to using the SAX parser. It’s (IMHO) just such an easier XML parser to deal with as well.

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

Sidebar

Related Questions

I am sending soap messages that contains arrays. I have problems with arrays in
I have a C# app that is sending soap requests over an https channel.
Sending XML from C# Server and receiving it it in Android Java client This
I am sending some SOAP headers to a WCF service and I am trying
I need to write a soap client that is capable of sending and receiving
I've been having trouble sending Matlab SOAP request callSoapService(endpoint,soapAction,message) <--http://www.mathworks.com/help/techdoc/ref/callsoapservice.html For instance how would
I'm sending SOAP requests to an external web service. There are several fields that
Is it possible to get the XML generated by SOAP Client before sending it
I am sending a SOAP POST and I am getting a HTTPError: HTTP Error
I am sending an XML SOAP request via CURL in PHP. Is there a

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.