Page 1 of 3

xHB TipClientHTTP( ) substitute ?

PostPosted: Wed Oct 10, 2012 5:48 pm
by TimStone
In my application, I have a call to the TIPClientHTTP class used in xHarbour. This is in an xHarbour library, built with Pelles C ( TipSSL.lib )

Now I need to make the same call but in my program built with Harbour and Microsoft VC 2010. The other library is not compatible.

Here is the description from the xHarbour documentation. Does anyone know of a Harbour workaround ?

Objects of the TIpClientHttp() class inherit from the generic internet client class TIpClient(). TIpClientHttp objects are used to communicate with an HTTP server. They use the Hyper Text Transfer Protocol (HTTP, RFC2616.TXT) for exchanging data between a local and a remote station on the World Wide Web (WWW). The address of the HTTP server must be provided as a URL string with method :new(). The URL is maintained by a TUrl() object, which is stored in the :oUrl instance variable.
The internet connection to the HTTP server must be established with the :open() method.
Once the internet connection is established (opened), data can be retrieved using the :readAll() method.
When all data is received, the internet connection must be closed with the :close() method.


Thank you.

Re: xHB TipClientHTTP( ) substiture ?

PostPosted: Wed Oct 10, 2012 11:29 pm
by modicr
There is a sample webclien.prg in FWH. Maybe it can help ...

Regards, Roman

Re: xHB TipClientHTTP( ) substitute ?

PostPosted: Thu Oct 11, 2012 4:41 pm
by TimStone
I'm not looking for a different method. I guess I wasn't clear.

Harbour supports a TipClientHTTP( ) class. In my current application builds I've tried linking hbtipssl.lib but then I receive numerous missing externals. I've tried hbtip.lib and that has a similar result.

I would love to know:
1) what is included in hbtipssl.lib. This was suggested to me previously but perhaps for another purpose.
2) what libs from harbour do I need to use to run the TipClientHTTP( ).

Re: xHB TipClientHTTP( ) substitute ?

PostPosted: Fri Oct 12, 2012 6:33 pm
by TimStone
I wanted to update this.

I am calling the TipClientHTTP( ) class. In xHarbour, it links in fine, but that library is not compatible with MSVC and Harbour.

There is a Harbour hbtip.lib which I tried linking in, but I get the following error:
hbrtl.lib(hbsocket.obj) : error LNK2019: unresolved external symbol __imp__WSAIoctl@36 referenced in function _hb_socketGetIFaces


I also had received a hbtipssl.lib, and that one, when linked in, receives the following errors:
Code: Select all  Expand view

hbtipssl.lib(client.obj) : error LNK2001: unresolved external symbol _HB_FUN_SSL_CONNECT
hbtipssl.lib(client.obj) : error LNK2001: unresolved external symbol _HB_FUN_SSL_SET_FD
hbtipssl.lib(client.obj) : error LNK2001: unresolved external symbol _HB_FUN_SSL_SET_MODE
hbtipssl.lib(client.obj) : error LNK2001: unresolved external symbol _HB_FUN_ERR_ERROR_STRING
hbtipssl.lib(client.obj) : error LNK2001: unresolved external symbol _HB_FUN_SSL_GET_ERROR
hbtipssl.lib(client.obj) : error LNK2001: unresolved external symbol _HB_FUN_HB_SSL_READ_ALL
hbtipssl.lib(client.obj) : error LNK2001: unresolved external symbol _HB_FUN_HB_SSL_READ_LINE
hbtipssl.lib(client.obj) : error LNK2001: unresolved external symbol _HB_FUN_SSL_READ
hbtipssl.lib(client.obj) : error LNK2001: unresolved external symbol _HB_FUN_SSL_WRITE
hbtipssl.lib(client.obj) : error LNK2001: unresolved external symbol _HB_FUN_SSL_SHUTDOWN
hbtipssl.lib(client.obj) : error LNK2001: unresolved external symbol _HB_FUN_SSL_NEW
hbtipssl.lib(client.obj) : error LNK2001: unresolved external symbol _HB_FUN_SSL_CTX_NEW
hbtipssl.lib(client.obj) : error LNK2001: unresolved external symbol _HB_FUN_RAND_SEED
hbtipssl.lib(client.obj) : error LNK2001: unresolved external symbol _HB_FUN_SSL_INIT
hbrtl.lib(hbsocket.obj) : error LNK2019: unresolved external symbol __imp__WSAIoctl@36 referenced in function _hb_socketGetIFaces
 


Its not my code that is the problem. Its that I need to be able to resolve the issue of what to link so I can build the application !

I'm using FWH 12.09, Antonio's Harbour build from the Five Tech website, and MSVC 2010.

I really do appreciate any assistance. I've also posted this in the Harbour forum but no answers yet. Before posting I did extensive searches and found that I posted about this problem many months ago but never got a resolution.

Thanks everyone.

Re: xHB TipClientHTTP( ) substitute ?

PostPosted: Sat Oct 13, 2012 11:31 am
by Antonio Linares
Tim,

Please check that you are linking WS2_32.lib from MSVC

Re: xHB TipClientHTTP( ) substitute ?

PostPosted: Sun Oct 14, 2012 9:36 pm
by TimStone
Antonio's suggestion worked to eliminate the build error.
Now I link in hbtip.lib and get a clean build.

However, the following line:

Local oHttp:=TIpClientHttp():new("https://website.com/", .F. ) // I left out the actual website ... its not important here

which works fine in xHarbour, generates the following error:

Error description: Error BASE/1081 Operation not supported: TIPCLIENTHTTP:new()

The error is occurring when tipclienthttp calls the client class.

I examined the source code in both harbour and xharbour and they appear to be almost identical.

Any further suggestions would be greatly appreciated ( especially any comments on how the implementation differs between xHarbour ( .com version ) and Harbour ( the compiler I prefer to use ).

Re: xHB TipClientHTTP( ) substitute ?

PostPosted: Tue Oct 16, 2012 7:00 pm
by TimStone
Roman, I looked at the sample but this is to exchange XML data so I need to Post a string to the website, then Read the response. Its not supported with the WebClient class.

Everyone:I am using the Harbour builds from Five Tech, specifically for MSVC 2010.

The Harbour forum says , in response to this problem:

[> Error description: Error BASE/1081 Operation not supported:
> TIPCLIENTHTTP:new()
That error is generated around line 210 in contrib\hbtip\client.prg
(look it up and see what it does!) and is the result of tIPClient
realizing that you are trying to use a protocol (https) that is not
supported in your current configuration. You need to download OpenSSL
and rebuild hbtip with it. There are instructions for that in INSTALL.


I apparently need a new hbtip as stated above, but I don't have the setup to build it. Does anyone have an updated MSVC library build for hbtip.lib they could send me ? It would be greatly appreciated.

Tim

Re: xHB TipClientHTTP( ) substitute ?

PostPosted: Tue Oct 16, 2012 8:57 pm
by ADutheil
Have a try with these:
ftp://dutheil.dyndns-server.com/hbtip.lib
ftp://dutheil.dyndns-server.com/hbtipssl.lib

Harbour Build Info
---------------------------
Version: Harbour 3.2.0dev (Rev. 17482)
Compiler: Microsoft Visual C++ 16.0.30319 (32-bit)
Platform: Windows 7 6.1.7601 Service Pack 1
PCode version: 0.3

Re: xHB TipClientHTTP( ) substitute ?

PostPosted: Tue Oct 16, 2012 9:16 pm
by TimStone
Thanks ... I tried the libs. Apparently they need an additional lib to be linked in.

hbtip.lib(httpcli.obj) : error LNK2001: unresolved external symbol _HB_FUN_HB_BLEN
hbtip.lib(client.obj) : error LNK2001: unresolved external symbol _HB_FUN_HB_BLEN
hbtip.lib(log.obj) : error LNK2001: unresolved external symbol _HB_FUN_HB_BLEN
hbtip.lib(encqp.obj) : error LNK2001: unresolved external symbol _HB_FUN_HB_BLEN
hbtip.lib(httpcli.obj) : error LNK2001: unresolved external symbol _HB_FUN_HB_DEFAULT
hbtip.lib(client.obj) : error LNK2001: unresolved external symbol _HB_FUN_HB_DEFAULT
hbtip.lib(encoder.obj) : error LNK2001: unresolved external symbol _HB_FUN_HB_DEFAULT
hbtip.lib(encqp.obj) : error LNK2001: unresolved external symbol _HB_FUN_HB_BCHAR
hbtip.lib(encqp.obj) : error LNK2001: unresolved external symbol _HB_FUN_HB_BCODE
hbtip.lib(encqp.obj) : error LNK2001: unresolved external symbol _HB_FUN_HB_BSUBSTR

Re: xHB TipClientHTTP( ) substitute ?

PostPosted: Wed Oct 17, 2012 1:05 am
by ADutheil
It´s probably because you have an outdated version of Harbour. Most of these functions were introduced last April as part of unicode support. You can dowload the full Harbour set for msvc 10 from ftp://dutheil.dyndns-server.com/hbmsvc10.zip

Re: xHB TipClientHTTP( ) substitute ?

PostPosted: Wed Oct 17, 2012 8:30 pm
by TimStone
Thanks for the libraries. However, I still have the same issue.

1) If I only link hbtip.lib, I get a successful build, but the error I mentioned before that does not allow me to create a new tipclienthttp object

2) If I link in hbtipssl.lib or hbtipssl.lib and hbtip.lib, I get the following error in the build:

hbtipssl.lib(client.obj) : error LNK2001: unresolved external symbol _HB_FUN_SSL_CONNECT
hbtipssl.lib(client.obj) : error LNK2001: unresolved external symbol _HB_FUN_SSL_SET_FD
hbtipssl.lib(client.obj) : error LNK2001: unresolved external symbol _HB_FUN_SSL_SET_MODE
hbtipssl.lib(client.obj) : error LNK2001: unresolved external symbol _HB_FUN_ERR_ERROR_STRING
hbtipssl.lib(client.obj) : error LNK2001: unresolved external symbol _HB_FUN_SSL_GET_ERROR
hbtipssl.lib(client.obj) : error LNK2001: unresolved external symbol _HB_FUN_HB_SSL_READ_ALL
hbtipssl.lib(client.obj) : error LNK2001: unresolved external symbol _HB_FUN_HB_SSL_READ_LINE
hbtipssl.lib(client.obj) : error LNK2001: unresolved external symbol _HB_FUN_SSL_READ
hbtipssl.lib(client.obj) : error LNK2001: unresolved external symbol _HB_FUN_SSL_WRITE
hbtipssl.lib(client.obj) : error LNK2001: unresolved external symbol _HB_FUN_SSL_SHUTDOWN
hbtipssl.lib(client.obj) : error LNK2001: unresolved external symbol _HB_FUN_SSL_NEW
hbtipssl.lib(client.obj) : error LNK2001: unresolved external symbol _HB_FUN_SSL_CTX_NEW
hbtipssl.lib(client.obj) : error LNK2001: unresolved external symbol _HB_FUN_RAND_SEED
hbtipssl.lib(client.obj) : error LNK2001: unresolved external symbol _HB_FUN_SSL_INIT

Re: xHB TipClientHTTP( ) substitute ?

PostPosted: Wed Oct 17, 2012 9:13 pm
by ADutheil
These functions belong to openssl. You probably have to download and install openssl. I don´t know if you have to link a lib or use any dll. I remember I had a similar issue using ssl with smtp but I cant find the project I was working for.

Re: xHB TipClientHTTP( ) substitute ?

PostPosted: Wed Oct 17, 2012 9:59 pm
by TimStone
OK so this one is beyond me. There are over 2400 files in the OPENSSL download ... and they are for a variety of OS's.

My task is simple. It works perfectly with xHarbour ( .com ) but fails with Harbour

Local oHttp:=TIpClientHttp():new("https://secured.server.com/document.cfx", .F. ) // Create the new object. THIS IS WHERE IT FAILS
Local cXml := " " // defined XML text to transfer
Local cRet
LOCAL oXmlDoc := TXmlDocument():new( )
LOCAL oXmlNode, oXmlRecScan, oXmlFieldScan
LOCAL cYear := "", cMake := "", cModel := "", cVin := "", cRetVin := " ", cMsg := " "

IF .NOT. oHttp:open() // Open the connection
MsgAlert( "Connection error:", oHttp:lastErrorMessage( ) )
RETURN
ENDIF

oHttp:Post( cXml) // Send the text

cRet := oHttp:readAll( ) // Receive the response
oHttp:close() // Close the connection

Is there an alternate way to do this within Harbour or Five Win ? Note the process:
1) Create the object
2) Create the XML statement
3) Open the connection
4) Send the XML statement
5) Receive the response
6) Close the connection

In such a massive application, this is the only thing not working now.

Re: xHB TipClientHTTP( ) substitute ?

PostPosted: Thu Oct 18, 2012 2:25 am
by ADutheil
I don´t know what to say because I just added

Code: Select all  Expand view

FUNCTION Test
Local oHttp:=TIpClientHttp():new("https://secured.server.com/document.cfx", .F. ) // Create the new object. THIS IS WHERE IT FAILS
 Local cXml := " " // defined XML text to transfer
 Local cRet
 LOCAL oXmlDoc := TXmlDocument():new( )
 LOCAL oXmlNode, oXmlRecScan, oXmlFieldScan
 LOCAL cYear := "", cMake := "", cModel := "", cVin := "", cRetVin := " ", cMsg := " "

 IF .NOT. oHttp:open() // Open the connection
 MsgAlert( "Connection error:", oHttp:lastErrorMessage( ) )
 RETURN
 ENDIF

 oHttp:Post( cXml) // Send the text

 cRet := oHttp:readAll( ) // Receive the response
 oHttp:close() // Close the connection
return nil


to a project I am currently working for and it linked ok without doing anything more. But gave a runtime error:
Code: Select all  Expand view
---------------------------
   Error BASE/1081  Opera‡Æo nÆo suportada: TIPCLIENTHTTP:new()
   Parameter   :
     [   1] = O   TIPCLIENTHTTP
     [   2] = C   https

Stack-List
----------
   chamado por TIPCLIENT:NEW(0)
   chamado por TIPCLIENTHTTP:NEW(0)
   chamado por TEST(286)
   chamado por MAIN(44)

I´ll investigate a bit more.

Re: xHB TipClientHTTP( ) substitute ?

PostPosted: Thu Oct 18, 2012 3:15 am
by TimStone
That is my exact problem. Clearly it is not able to create the new object.

Computers need to rattle our cages.