You Are Here:

Community: Developer Discussion Boards

#1 Old Question Problem extracting file from HTTP response - 2008-02-11, 14:28

Join Date: Sep 2007
Posts: 54
nick_santa83
Offline
Regular Contributor
Hi, I am currently writing a program that sends a HTTP get to a server and along with the HTTP response, the server sends me a XML file. What I am trying to do is to save this file. However i encountered the problem whereby the whole response message is saved. Below is an example of what was saved in the file.

<XML>....<info></info>...</XML>System.Threading.ThreadABortException:Thread was being aborted. at System.Threading. Thread.Abort(object stateinfo) at System Web. HttpResponse.End()at......

The code i used is:
Code:
status1, reason1, read1 = post_multipart(host, selector, fields, files)
if status1 > 0:
		f = file(path_xml, 'wb')
		f.write(read1)
		f.close()
		appuifw.note(u"Query response received", "info")
		read_xml(path_xml)
def read_xml(path_xml):
	print path_xml
	doc = ET(file=path_xml)
	#find the "path" element by tag name
	body = doc.getroot().findall("info")[0]
	#print body
	download_path = body.text
	print download_path
	download_query(download_path)
Can anyone help me to either save the xml without the rest of the HTTP response msg or teach me how to retrieve the data for the element info. When I tried to real xml, I encountered error due to the unwanted information in the xml file.

I tried google and search but could get no answer. So pls someone help me out
Last edited by nick_santa83 : 2008-02-12 at 05:25.
Reply With Quote

#2 Old Re: Problem extracting file from HTTP response - 2008-02-12, 10:02

Join Date: Jan 2004
Posts: 369
Location: Helsinki
Send a message via Skype™ to miohtama
miohtama's Avatar
miohtama
Offline
Regular Contributor
Quote:
<XML>....<info></info>...</XML>System.Threading.ThreadABortException:Thread was being aborted. at System.Threading. Thread.Abort(object stateinfo) at System Web. HttpResponse.End()at......
This looks like invalid XML code. You need to fix XML generation at the server side or clean up response string manually (wrong way to go).


Mikko Ohtamaa
Twinapex Research
http://www.twinapex.com
Reply With Quote

#3 Old Re: Strange that no one ever has this problem - 2008-02-18, 06:37

Join Date: Sep 2007
Posts: 54
nick_santa83
Offline
Regular Contributor
ok. thanks alot
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
Strange problem "java.lang.Error 105" aadipa Mobile Java General 6 2009-10-22 10:21
Strange problem while installing Carbide.C++ express jugnoyasir Carbide.c++ IDE and plug-ins 4 2008-10-06 21:19
strange problem !!! metebalci Mobile Java General 0 2005-09-30 09:41
VERY strange memory full problem.. etamburini Mobile Java General 9 2005-05-17 16:50
very strange problem victorh81 General Symbian C++ 1 2003-12-09 10:09

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia