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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T17:27:33+00:00 2026-05-29T17:27:33+00:00

I am following this Virtuoso Web Service example . My the response from a

  • 0

I am following this Virtuoso Web Service example. My the response from a POST has a non-zero .length, but .read() is empty. This only happens when POST is successful. If I intentionally make a mistake I will get a non-zero .read().

import httplib
url = 'lod.openlinksw.com'   

xmlString = '''<?xml version="1.0"?>
<query xmlns="http://openlinksw.com/services/facets/1.0" inference="" same-as="">
  <text>Seattle Mariners traveled all the way to Japan to watch</text>
  <view type="text" limit="20" offset=""/>
</query>'''

xml = open('a.xml','w')
xml.write(xmlString)
xml.close()
xml = open('a.xml')

headers = {'Content-Type': 'text/xml',}
conn = httplib.HTTPConnection(url)
conn.request("POST", "/fct/service", xml, headers)
re = conn.getresponse()
conn.close()

data = re.read()
print re.reason, re.status, '| len:', re.length, '| read() len:', len(data)

Return…

OK 200 | len: 19902 | read() len: 0

If you intentionally malform the XML (e.g. “query” >> “queryzzz”)…

Internal Server Error 500 | len: 0 | read() len: 340

I am sure I am just doing something silly. Where’s my 19902 byte response?

  • 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-29T17:27:34+00:00Added an answer on May 29, 2026 at 5:27 pm

    Change

    conn.close()
    
    data = re.read()
    

    to

    data = re.read()
    conn.close()
    

    You need to read the data before closing the connection or any not yet transferred bytes will be lost.

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

Sidebar

Related Questions

following this link i was able to load and read pixels from a .gif.
Following this SO post I was able to take screenshots but they turned out
Following this link I tried sending a XML file to my web service using
Following this question, it seems that it is possible to open a file from
Following this python example , I encode a string as Base64 with: >>> import
Following this post which I posted some time ago, I now get the same
Following this nice example I found, I was trying to create a function that
im following this example http://jsfiddle.net/rniemeyer/badZb/ . I just copy and paste the exact code
Following this post (I was looking for a library allowing me to declare Django
Following this question which asks (and answers) how to read .mat files that were

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.