Обсуждение: calling webservice through postgresql function

Поиск
Список
Период
Сортировка

calling webservice through postgresql function

От
"Jyoti Seth"
Дата:
<div class="Section1"><p class="MsoNormal">Hi all,<p class="MsoNormal"> <p class="MsoNormal">I want to call webservice
frommy postgresql database. Please let me know if anyone has idea.<p class="MsoNormal"> <p class="MsoNormal">Thanks,<p
class="MsoNormal">JyotiSeth</div> 

Re: calling webservice through postgresql function

От
Richard Huxton
Дата:
Jyoti Seth wrote:
> Hi all,
> 
> I want to call webservice from my postgresql database. Please let me know if
> anyone has idea.

You can use any of the "untrusted" procedural languages to access 
resources outside the database (e.g. pl/perlu), or of course C.

--   Richard Huxton  Archonet Ltd


Re: calling webservice through postgresql function

От
"Jyoti Seth"
Дата:
Thanks a lot for ur quick response. I have searched a lot on net for code to
call a webservice through tcl/tk or any other scripting lang that is
supported by postgresql, but couldn't find one. If u can provide me some
code to call a web service through postgresql it would be a great help.

Thanks,
Jyoti Setj

-----Original Message-----
From: Richard Huxton [mailto:dev@archonet.com] 
Sent: Friday, July 13, 2007 12:57 PM
To: Jyoti Seth
Cc: pgsql-sql@postgresql.org
Subject: Re: [SQL] calling webservice through postgresql function

Jyoti Seth wrote:
> Hi all,
> 
> I want to call webservice from my postgresql database. Please let me know
if
> anyone has idea.

You can use any of the "untrusted" procedural languages to access 
resources outside the database (e.g. pl/perlu), or of course C.

--   Richard Huxton  Archonet Ltd



Re: calling webservice through postgresql function

От
Richard Huxton
Дата:
Jyoti Seth wrote:
> Thanks a lot for ur quick response. I have searched a lot on net for code to
> call a webservice through tcl/tk or any other scripting lang that is
> supported by postgresql, but couldn't find one. If u can provide me some
> code to call a web service through postgresql it would be a great help.

Just use pl/perlu (or pythonu or tclu) in whatever way you would 
normally "call a webservice". That side of things has nothing to do with 
PG (other than the fact that it will hold up your query).

If you don't know how to "call a webservice" then you'll need to check 
with one of the developer forums for your language of choice I'm afraid.

--   Richard Huxton  Archonet Ltd


Re: calling webservice through postgresql function

От
"A. Kretschmer"
Дата:
am  Fri, dem 13.07.2007, um 13:01:30 +0530 mailte Jyoti Seth folgendes:
> Thanks a lot for ur quick response. I have searched a lot on net for code to
> call a webservice through tcl/tk or any other scripting lang that is
> supported by postgresql, but couldn't find one. If u can provide me some
> code to call a web service through postgresql it would be a great help.

As Richard says, use an untrusted language like pl/perlU (U means
untrusted) to call arbitrary external programs.


Andreas
-- 
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net


Re: [OBORONA-SPAM] calling webservice through postgresql function

От
Dmitry Turin
Дата:
Good day, Jyoti.

JS> I want to call webservice from my postgresql database. Please let me know if anyone has idea.

Idia or proper tool?
If idea, I offer to append some code into source of pg.

I already raised this question in topic
"We all are looped on Internet",
in which i read, that the most widespread transport protocol is HTTP,
and the most general format for data is XML (XHTML).
Idea is so: if we made

create table a ( id   num      primary key, data float
);
create table b ( id   num      primary key, ref  num      references a(id), data float
);
create table c ( id   num      primary key, link num      references b(id), data float
);
insert into a values (1,     12.3);
insert into b values (10, 1, 23.4);
insert into b values (20, 1, 34.5);
insert into b values (30, 1, 45.6);
insert into c values (100,10,56.7);
insert into c values (101,10,67.8);
insert into c values (200,20,78.9);
insert into c values (201,20,89.1);
insert into c values (300,30,91.2);

we need simple request 'a.b.c' to get 

<a     id=1   data=12.3> <b   id=10  data=23.4>   <c id=100 data=56.7/>   <c id=101 data=67.8/> </b> <b   id=20
data=34.5>  <c id=200 data=78.9/>   <c id=201 data=89.1/> </b> <b   id=30  data=45.6>   <c id=200 data=91.2/> </b>
 
</a>

Request 'a.b.c' allow to avoid php,etc,
that is very necessary for unskilled users!

Details are on:
http://sql40.chat.ru/site/sql40/en/author/introduction_eng.htm
http://sql40.chat.ru/site/sql40/en/author/determination_eng.htm
http://sql40.chat.ru/site/sql40/en/author/inout_eng.htm



Dmitry Turin
HTML6     (6.1.2)  http://html60.chat.ru
SQL4      (4.1.2)  http://sql40.chat.ru
Unicode2  (2.0.0)  http://unicode2.chat.ru
Computer2 (2.0.3)  http://computer20.chat.ru



Re: [OBORONA-SPAM] calling webservice through postgresql function

От
"Jyoti Seth"
Дата:
Hello Dmity,

As suggested by Richard Huxton in this forum we can use any of the
"untrusted" procedural languages to access resources outside the database
(e.g. pl/perlu).

You can get the code to call the webservice from the postgresql function
from this url. http://www.pgsql.cz/index.php/PL/Perlu_-_Untrusted_Perl_(en)

Thanks,
Jyoti

-----Original Message-----
From: pgsql-sql-owner@postgresql.org [mailto:pgsql-sql-owner@postgresql.org]
On Behalf Of Dmitry Turin
Sent: Monday, July 16, 2007 6:49 PM
To: pgsql-sql@postgresql.org
Subject: Re: [OBORONA-SPAM] [SQL] calling webservice through postgresql
function

Good day, Jyoti.

JS> I want to call webservice from my postgresql database. Please let me
know if anyone has idea.

Idia or proper tool?
If idea, I offer to append some code into source of pg.

I already raised this question in topic
"We all are looped on Internet",
in which i read, that the most widespread transport protocol is HTTP,
and the most general format for data is XML (XHTML).
Idea is so: if we made

create table a ( id   num      primary key, data float
);
create table b ( id   num      primary key, ref  num      references a(id), data float
);
create table c ( id   num      primary key, link num      references b(id), data float
);
insert into a values (1,     12.3);
insert into b values (10, 1, 23.4);
insert into b values (20, 1, 34.5);
insert into b values (30, 1, 45.6);
insert into c values (100,10,56.7);
insert into c values (101,10,67.8);
insert into c values (200,20,78.9);
insert into c values (201,20,89.1);
insert into c values (300,30,91.2);

we need simple request 'a.b.c' to get 

<a     id=1   data=12.3> <b   id=10  data=23.4>   <c id=100 data=56.7/>   <c id=101 data=67.8/> </b> <b   id=20
data=34.5>  <c id=200 data=78.9/>   <c id=201 data=89.1/> </b> <b   id=30  data=45.6>   <c id=200 data=91.2/> </b>
 
</a>

Request 'a.b.c' allow to avoid php,etc,
that is very necessary for unskilled users!

Details are on:
http://sql40.chat.ru/site/sql40/en/author/introduction_eng.htm
http://sql40.chat.ru/site/sql40/en/author/determination_eng.htm
http://sql40.chat.ru/site/sql40/en/author/inout_eng.htm



Dmitry Turin
HTML6     (6.1.2)  http://html60.chat.ru
SQL4      (4.1.2)  http://sql40.chat.ru
Unicode2  (2.0.0)  http://unicode2.chat.ru
Computer2 (2.0.3)  http://computer20.chat.ru


---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster



Re: calling webservice through postgresql function

От
Dmitry Turin
Дата:
Good day, Jyoti.

JS> we can use any of the "untrusted" procedural languages
JS> http://www.pgsql.cz/index.php/PL/Perlu_-_Untrusted_Perl_(en)
What !! There is no need to have  CREATE OR REPLACE FUNCTION  open FILE, $_[0]; my @cntn = ();  while (<FILE>) { }
__Youas man (by hands) convert__ tree of data into database tables
 
by procedural language once again.
You are wrong: all, which is necessary, is to have __a.b.c__ in language for
JS> create table a (
JS>   id   num      primary key,
JS>   data float
JS> );
JS> create table b (
JS>   id   num      primary key,
JS>   ref  num      references a(id),
JS>   data float
JS> );
JS> create table c (
JS>   id   num      primary key,
JS>   link num      references b(id),
JS>   data float
JS> );

JS>  to access resources outside the database
JS> (e.g. pl/perlu).
There is no need to have  CREATE OR REPLACE FUNCTION  use DBI;  my $dbh = DBI->connect('dbi:mysql:'.$_[0],$_[1],$_[2],
   { RaiseError => 1, AutoCommit = > });
 
 __You as man (by hands) install connect__ between DBMS and external world
by procedural language once again.
You are wrong once again:
advantage is to __refuse__ from procedural language (to install connect)
instead of put it from outside of DBMS into inside of DBMS.
All, which is necessary, is DBMS itself listen some port/protocol.


Dmitry Turin
SQL4      (4.1.3)  http://sql40.chat.ru
HTML6     (6.3.0)  http://html6.by.ru
Unicode2  (2.0.0)  http://unicode2.chat.ru
Computer2 (2.0.3)  http://computer20.chat.ru



Re: calling webservice through postgresql function

От
Dmitry Turin
Дата:
Good day, Jyoti.

JS>> (e.g. pl/perlu).
DT>   __You as man (by hands) install connect__ between DBMS and external world
DT> by procedural language once again.
DT> You are wrong once again:
DT> advantage is to __refuse__ from procedural language (to install connect)
DT> instead of put it from outside of DBMS into inside of DBMS.
DT> All, which is necessary, is DBMS itself listen some port/protocol.

My version:

(1.1)
User send to remote database (HTTP will ask login):
c:/dir>  xml2http.exe database.my.com username password a.xml
for example
c:/dir>  dbf2xml.exe a.dbf | xml2http.exe database.my.com username password

(1.2)
User send to local database (at transformation data between DBMS-s):
c:/dir>  xml2http.exe 127.0.0.1 username password a.xml
for example
c:/dir>  dbf2xml.exe a.dbf | xml2http.exe 127.0.0.1 username password

(2.1)
Database send to local file (at transformation data between DBMS-s):
pg>      copy a.b.c to filename.xml;

(2.2)
Database send to remote database
(if 'sys.username' and 'sys.password' are equal null,
then database sends as anonymous):
pg>      update sys set
pg>        ral="database.remote.com",
pg>        username=
pg>        password= ;
pg>      a.b.c ->;
or
pg>      update sys set
pg>        ran="101.102.103.104",
pg>        username=
pg>        password= ;
pg>      a.b.c ->;
or if you prefer to export per table
pg>      update sys set ral="database.remote.com";
pg>      create view av as select * from a where ...
pg>      create view bv as select * from b where ...
pg>      create view cv as select * from c where ...
pg>      av ->;
pg>      bv ->;
pg>      cv ->;


Once again: users need simple instruments, instead of your (in you link)
JS>>    CREATE OR REPLACE FUNCTION
JS>>    use DBI;
JS>>    my $dbh = DBI->connect('dbi:mysql:'.$_[0],$_[1],$_[2],
JS>>       { RaiseError => 1, AutoCommit = > });

Do you understand me ?


Dmitry Turin
SQL4      (4.1.3)  http://sql40.chat.ru
HTML6     (6.3.0)  http://html6.by.ru
Unicode2  (2.0.1)  http://unicode2.chat.ru
Computer2 (2.0.3)  http://computer20.chat.ru