Page 1 of 2

WebServiceProxy Example

Posted: 07.02.2022, 19:55
by fjtrooper
Hello! Anyone has an example of how to configure WebServiceProxy for mysql connection?
Thanks!!!

Re: WebServiceProxy Example

Posted: 08.02.2022, 11:44
by marsupilami
Hello fjtrooper,

based on my own configuration a very simple server config could look like this:

Code: Select all

[general]
  Database Prefix = db.
  Security Prefix = sec.
  Listening Port = 8000

[db.ZeosTest]
  ClientCodepage = UTF8
  Database = mydatabase
  HostName = somehost
  LibraryLocation = C:\Program Files (x86)\MariaDB\MariaDB Connector C\lib\libmariadb.dll
  Protocol = mysql
In TZConnection you would set UTF8 as the connection character set. Host is the ip address or host name of your server. Maybe you have to specify the port number. The database name would be "ZeosTest". Username and password will be forwarded to MySQL / MariaDB in this configuration.

Please note: I didn't test the webserviceproxy protocol with MariaDB or MySQL. Please let me know of any problems.

Best regards,

Jan

Re: WebServiceProxy Example

Posted: 08.02.2022, 14:41
by fjtrooper
Ok thanks, I'll try and I'll give you feedback.

THX

Re: WebServiceProxy Example

Posted: 08.02.2022, 14:57
by fjtrooper
I did the configuration, but Lazarus hangs when I activate ZConnection until I stop WebServiceProxy, never connect, and I receive an error message like this.

HTTP Request to
https://localhost:8000/serices/IZeosProxy Failed

It tries to find "https" and not "http" by default?

Thanks

Re: WebServiceProxy Example

Posted: 10.02.2022, 09:55
by marsupilami
fjtrooper wrote: 08.02.2022, 14:57 It tries to find "https" and not "http" by default?
Yes - the idea was to make it secure by design. Even though the server doesn't use TLS (a restriction of the Webservice Toolkit) I figured that most users would want to use apache with SSL configured as a reverse proxy for attaching the clients. Otherwise passwords and data will be sent unencrypted over the wire...

You can tell the client to use http by using the following line:

Code: Select all

ZConnection.Properties.Add('ProxyProtocol=http');

Re: WebServiceProxy Example

Posted: 10.02.2022, 10:26
by fjtrooper
Perfect! Now it seems to connect.
I have now a new error message :(
When I acitvate ZConnection the error message is:

Code="Server"
Message= "Requested database driver was not found"


In ZConnection I set Protocol WebServiceProxy, and LibraryLocation is my libzdbcproxy.dll location.
In zeosproxy.ini, LibraryLocation of DB is also set and seems OK.

Thank you very much!!!!

Re: WebServiceProxy Example

Posted: 10.02.2022, 13:25
by fjtrooper
fjtrooper wrote: 10.02.2022, 10:26 Perfect! Now it seems to connect.
I have now a new error message :(
When I acitvate ZConnection the error message is:

Code="Server"
Message= "Requested database driver was not found"


In ZConnection I set Protocol WebServiceProxy, and LibraryLocation is my libzdbcproxy.dll location.
In zeosproxy.ini, LibraryLocation of DB is also set and seems OK.

Thank you very much!!!!
This error is using MYsql server.

When I try with Postgresql , the error is:

Code = "Server"
Message = "System error, (OS Code 126):
Can't find specific module

Re: WebServiceProxy Example

Posted: 10.02.2022, 23:36
by fjtrooper
I forgot tell you that I'm using version 8

Re: WebServiceProxy Example

Posted: 11.02.2022, 08:30
by marsupilami
fjtrooper wrote: 10.02.2022, 10:26 Code="Server"
Message= "Requested database driver was not found"
I didn't experiment with Lazarus much, I have to say. I assume that the >Code="Server"< part means that the problem happens on the server side. >Message= "Requested database driver was not found"< means that the requested driver was not found by Zeos. What is yor value for "Protocol"? Did you set it to "mysql"? Could you share your zeosproxy.ini? That could make hunting down the problem much more easy ;)

Re: WebServiceProxy Example

Posted: 11.02.2022, 10:33
by fjtrooper
[General]
Database Prefix = db.
Security Prefix = sec.
;IP Address = 0.0.0.0
Listening Port = 8000

[db.bdfarmacia]
ClientCodepage = UTF8
Database = bdfarmacia
HostName = 127.0.0.1
LibraryLocation = c:\library\libmysql.dll
Protocol = mysql


[db.test]
ClientCodepage = UTF8
Database = test
HostName = localhost
LibraryLocation = c:\library\libpq.dll
Protocol = postgresql

Re: WebServiceProxy Example

Posted: 13.02.2022, 09:13
by marsupilami
The proxy server doesn't include all protocols by default. My mistake. Please add ZDbcMySql to the uses clause of the zeosproxyunit.pas or to the ZDbcProxyServer.pas - depending on wether you use the server service or the server application. That should add mysql to the list of available protocols. I will add the unit in the source control too.

Re: WebServiceProxy Example

Posted: 13.02.2022, 22:28
by fjtrooper
marsupilami wrote: 13.02.2022, 09:13 The proxy server doesn't include all protocols by default. My mistake. Please add ZDbcMySql to the uses clause of the zeosproxyunit.pas or to the ZDbcProxyServer.pas - depending on wether you use the server service or the server application. That should add mysql to the list of available protocols. I will add the unit in the source control too.

Oki I'll try it!
Thanks!

Re: WebServiceProxy Example

Posted: 15.02.2022, 13:45
by fjtrooper
Hello! I've tested and have theses problems:

When I add ZDbcmysql to Proxyserver Application, doesn't compile, and get this error.
ZDbcMySqlStatement.pas(2143,17) Error: identifier idents no member "AddAscii7Text"

When I add ZDbcpostgresql to Proxyserver Application, it compiles perfect.

As with zdbcmysql compilation fails, I couldn't try with mysql, so I tried to test with Postgresql.
Using Postgresql I always get the error "System Error (OS 193)", also trying the connection with a direct conection in a TEST APP and also fails.
I tried with postgesql 11 and 14, and also with different libpq.dll.

I use version 8 revision 7770

Thanks!!

Re: WebServiceProxy Example

Posted: 18.02.2022, 09:35
by marsupilami
Hello fjtrooper,

I added all currently supported protocols to the proxy servers. Please update your sources from SVN. The proxy servers compile for me without problems. My configuration:
Lazarus 2.0.12, Windows 32 bits, FPC 3.2.2.

Please let me know, if this fixes your problems.

Best regards,

Jan

Re: WebServiceProxy Example

Posted: 18.02.2022, 23:05
by fjtrooper
marsupilami wrote: 18.02.2022, 09:35 Hello fjtrooper,

I added all currently supported protocols to the proxy servers. Please update your sources from SVN. The proxy servers compile for me without problems. My configuration:
Lazarus 2.0.12, Windows 32 bits, FPC 3.2.2.

Please let me know, if this fixes your problems.

Best regards,

Jan
okk I'll try! Thanks!