xHarbour issue: seeking ideas

xHarbour issue: seeking ideas

Postby TimStone » Thu Feb 20, 2014 8:08 pm

I am retrieving an XML document from a website using the following code:

Code: Select all  Expand view

       cXML := XMLtext
    oHttp:=TIpClientHttp():new("https://www.website.com" )
    oHttp:open()
    oHttp:Post( cXml)
    cRet :=  oHttp:readAll( )
    oHttp:close()
 


Everything works fine EXCEPT xHarbour truncates the return string stored in cRet. It reads 8192 characters ( but actually saves about half of it ). The exact same code in Harbour reads the full 22KB of return data and saves it all.

I'm using an older version ( xHarbour.com ). I'm wondering if there is any undocumented data that needs to be specified to get the full string with the xHarbour code.

I appreciate your ideas on this matter.
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2913
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: xHarbour issue: seeking ideas

Postby James Bott » Fri Feb 21, 2014 1:34 am

Tim,

It reads 8192 characters ( but actually saves about half of it ).


Please explain. Are you checking the length with len(cRet) and it returns 8192? What do you mean by it only saves half of it?

I am thinking that perhaps there is an invisible character in the middle?

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: xHarbour issue: seeking ideas

Postby TimStone » Fri Feb 21, 2014 1:59 am

This is an XML transmission. The file size is reported to be 8192 bites in length ( with the LEN( ) ) function. I save it with MemoWrit( ), and then open it in my editor. It shows on the File description that it is about 8KB in size, but only about the first 10 lines of text actually show and the rest is blank.

Now, the exact same code when using my Harbour / MSVC build reads the full XML transmission, which is about 25 KB in length.

So, either the xHarbour code sets some type of buffer limit, or times out during the transmission.
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2913
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: xHarbour issue: seeking ideas

Postby James Bott » Fri Feb 21, 2014 2:53 am

Tim,

So, either the xHarbour code sets some type of buffer limit, or times out during the transmission.


Or, it could be memowrit(), memoread(), and/or the editor you are using. Either of them could be stumbling on an unseen character.

I would process the entire string looking for non-numeric and non-alpha characters and replace them with maybe an asterisk or some other symbol.

Also, try just doing msgInfo( cRet ) without saving it.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: xHarbour issue: seeking ideas

Postby TimStone » Fri Feb 21, 2014 2:49 pm

Its not Memowrit or the editor. The data is simply being cut off by the ReadAll( ) method. The question is how to get around that with xHarbour.

The exact same data feed is being received, and read correctly, with the Harbour version.
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2913
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: xHarbour issue: seeking ideas

Postby James Bott » Fri Feb 21, 2014 3:22 pm

Tim,

The data is simply being cut off by the ReadAll( ) method.


I'm sorry, I must be misunderstanding something. Are you doing:

Code: Select all  Expand view
cRet :=  oHttp:readAll( )
msgInfo( len( cRet) )
 

and the msgInfo( len( cRet ) ) returns 8192. If yes, then why are you stating the the readAll() truncates the data? Or, are you stating that the msgInfo( len(cRet) ) returns something less than 8192?

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: xHarbour issue: seeking ideas

Postby TimStone » Fri Feb 21, 2014 3:39 pm

James,

First, the actual size of the feed is about 26 KB. The entire feed is read using the ReadAll( ) in Harbour. It can then be viewed also.

Using xHarbour, only 8192 bytes are returned, and only the first half are actual characters. The rest is blanks until the EOF marker.

In translated XML terms, xHarbour returns only about 21 1/2 lines of XML text. Harbour returns the full 322 lines.


Tim
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2913
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: xHarbour issue: seeking ideas

Postby James Bott » Fri Feb 21, 2014 5:05 pm

Tim,

OK, now I understand.

What version of xHarbour.com are you using? Or, rather when was it published?

Have you tried a different XML file just to see if it related to that particular file?

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: xHarbour issue: seeking ideas

Postby Enrico Maria Giordano » Fri Feb 21, 2014 6:19 pm

Tim,

The following sample works fine here using latest xHarbour from SVN and latest FWH:

Code: Select all  Expand view
#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oHttp

    LOCAL cRet

    oHttp = TIpClientHttp():New( "http://www.emagsoftware.it/download.htm" )

    oHttp:Open()

    cRet = oHttp:ReadAll()

    oHttp:Close()

    ? LEN( cRet )

    MEMOWRIT( "MYRESULT.TXT", cRet )

    RETURN NIL


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8419
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: xHarbour issue: seeking ideas

Postby TimStone » Fri Feb 21, 2014 6:30 pm

I'm using xHarbour.com from August 2010. That was a "for use" release ( but still called a Beta ). Since then they were mostly doing the Visual xHarbour stuff. Unfortunately I can't just swap in the latest public xHarbour ...

I'm using the more recent Harbour that Antonio provided for use with Microsoft Visual C 2012.
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2913
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: xHarbour issue: seeking ideas

Postby Enrico Maria Giordano » Fri Feb 21, 2014 6:42 pm

Tim,

TimStone wrote:I'm using xHarbour.com from August 2010.


That explains all. You can't use a four years old release and expect to not find strange behavior, don't you? :-)

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8419
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: xHarbour issue: seeking ideas

Postby TimStone » Thu Feb 27, 2014 12:49 am

Actually, I asked and essentially got the message that not much has been done on the subscription version except for Visual xHarbour. Are you using the .com version ( with xBuilder ?
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2913
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: xHarbour issue: seeking ideas

Postby Enrico Maria Giordano » Thu Feb 27, 2014 9:41 am

Tim,

TimStone wrote:Actually, I asked and essentially got the message that not much has been done on the subscription version except for Visual xHarbour. Are you using the .com version ( with xBuilder ?


A lot of fixes have been done to TIp class on the official xHarbour version. As an example, I find this in the changelog that can be related to your problem:

2013-09-03 10:30 UTC-300 Luiz Rafael Culik <luiz/AT/xharbour/com/br>
* source/tip/client.prg
contrib/tipssl/client.prg
* fixed read method to allow long http response
* contrib/tipssl/httpcln.prg
* change to allow Connection: field in http header allow other values then close


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8419
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: xHarbour issue: seeking ideas

Postby TimStone » Thu Feb 27, 2014 4:26 pm

That is fine, but I would have to be a large amount of money to upgrade to the recent commercial version hoping that had been included.

I don't believe xBuild will work with anything but the .com version.
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2913
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 44 guests