PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → Pass parameters to a Webservice
Pass parameters to a Webservice
Iniciado por Gautam, 14,mar. 2016 14:04 - 6 respuestas
Miembro registrado
67 mensajes
Publicado el 14,marzo 2016 - 14:04
Hi All

I have a WEBSERVICE that connects to a database. I want the ability for the webservice to change the connection to the database based on a parameter received from the calling client website.

I would like to use the same webservice across multiple customers as each customer's data is maintained in a different database. Its a bit like the SAAS model provided with WB but at a webservice level and not at a website level.

The model I would like is as follows:

1. Website connects to a webservice and passes a parameter (the parameter specifies which customer is connecting). Here I would like to know how the website can pass the parameter to the webservice?

2. The webservice uses the parameter to setup the connection to the correct database (specific database of the customer). Here I would like to know how the webservice can read the parameter that was sent by the calling website in 1 above.

3. After the above is done each procedure call to the webservice must automatically connect to the relevant customer database and provide results based on data in the custoemers database.

The webservice runs in a secure internal network and the calling website runs in a DMZ. The website must not make direct calls to the underlying database. Only the webservice can access the database.

Can anyone guide me on how to achieve the above?

Gautam
Publicado el 14,marzo 2016 - 15:45
Hi

all your questions first depends on the TYPE of webservice you plan to
use, SOAP, or REST

SOAP is described in details in the help, REST is achieved via a webdev
AWP page

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

Ready for you: WXShowroom.com, WXReplication (open source) and now WXEDM
(open source)

More information on http://www.fabriceharari.com

On 3/14/2016 8:04 AM, Gautam wrote:
Hi All

I have a WEBSERVICE that connects to a database. I want the ability for
the webservice to change the connection to the database based on a
parameter received from the calling client website.

I would like to use the same webservice across multiple customers as
each customer's data is maintained in a different database. Its a bit
like the SAAS model provided with WB but at a webservice level and not
at a website level.

The model I would like is as follows:

1. Website connects to a webservice and passes a parameter (the
parameter specifies which customer is connecting). Here I would like to
know how the website can pass the parameter to the webservice?

2. The webservice uses the parameter to setup the connection to the
correct database (specific database of the customer). Here I would like
to know how the webservice can read the parameter that was sent by the
calling website in 1 above.

3. After the above is done each procedure call to the webservice must
automatically connect to the relevant customer database and provide
results based on data in the custoemers database.

The webservice runs in a secure internal network and the calling website
runs in a DMZ. The website must not make direct calls to the underlying
database. Only the webservice can access the database.

Can anyone guide me on how to achieve the above?

Gautam
Miembro registrado
67 mensajes
Publicado el 14,marzo 2016 - 17:11
Hi Fabrice

Thanks for responding.

My webservice is SOAP. I want to pass a parameter when calling the webservice for example something like:

http://www.mydomain.com/MYPROJECT_WEB/Myproject.awws… (passing a parameter called DBConnection with a value of CustomerOne)

and trap the DBConnection=CustomerOne in the actual webservice and use this parameter to determine which db the webservice must connect to.

The question is how do I get the value of the parameter in the webservice? What command inside the webservice will allow me to read the value that was passed in the calling url?

I hope I make sense.

Gautam
Publicado el 14,marzo 2016 - 20:08
Hi

read up on webservices in the windev help: What you can call in a
webservice are PROCEDURES, and therefore passing and using parameters is
the same than for any procedures

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

Ready for you: WXShowroom.com, WXReplication (open source) and now WXEDM
(open source)

More information on http://www.fabriceharari.com


On 3/14/2016 11:11 AM, Gautam wrote:
Hi Fabrice

Thanks for responding.

My webservice is SOAP. I want to pass a parameter when calling the
webservice for example something like:

http://www.mydomain.com/MYPROJECT_WEB/Myproject.awws…
(passing a parameter called DBConnection with a value of CustomerOne)

and trap the DBConnection=CustomerOne in the actual webservice and use
this parameter to determine which db the webservice must connect to.

The question is how do I get the value of the parameter in the
webservice? What command inside the webservice will allow me to read
the value that was passed in the calling url?

I hope I make sense.

Gautam
Miembro registrado
67 mensajes
Publicado el 15,marzo 2016 - 12:41
Hi Fabrice

Yes, I understand webservices are procedures.

My application's architecture is as follows:

1. A website that has only the GUI logic in it.
2. A webservice that contains all the business logic in it.
3. A database that is accessed by the webservice
4. The connection from the webservice to the Database is defined in the initialization code of the Webservice.
5. There are over 200 procedures in the Webservice most of which use the underlying database.

I want to achieve the following:

1. A Customer logs into the website. The website connects to the webservice and calls a specific procedure in the webservice. The procedure call in turn accesses the database and performs the necessary function. The connection to the database was setup in the initialization code of the webservice.

I want to pass a header parameter to the webservice that allows me to change the connection parameters in the initialization code so I can switch to a different database per customer.

I do not want to pass connection parameter in each procedure call (over 200 procedures).

I was hoping something like SoapAddHeader or some similar command when calling the webservice will allow me to pass the parameter to the webbservice at a webservice connection level and not at at procedure call level.

If my website was connecting directly to a database then I could have used the SaaS model supplied with Webdev to achieve the above. But because my data connection is through a webservice I am not sure how I can achieve the same SaaS model using a webservice.

Can a webservice be published as SaaS?

I am open to any suggestions, ideas, other methods/architecture that would allow me to to achieve the SaaS model but using webservices.

Thanks and regards

Gautam
Publicado el 15,marzo 2016 - 13:46
Hi again

This is just what -I- in a case like that (mostly with rest webservices,
but the principle will work here too)

IN the first call, I send the login information. If valid this create a
session (I store it as a record in the DB) and returns a session
identifier (it can be a GUID)

IN all subsequent calls, I send the session identifier. I check in the
DB that it's valid, what are the user rights, and if the session is
still active (time out).

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

Ready for you: WXShowroom.com, WXReplication (open source) and now WXEDM
(open source)

More information on http://www.fabriceharari.com


On 3/15/2016 6:41 AM, Gautam wrote:
Hi Fabrice

Yes, I understand webservices are procedures.
My application's architecture is as follows:

1. A website that has only the GUI logic in it.
2. A webservice that contains all the business logic in it.
3. A database that is accessed by the webservice
4. The connection from the webservice to the Database is defined in the
initialization code of the Webservice.
5. There are over 200 procedures in the Webservice most of which use
the underlying database.

I want to achieve the following:

1. A Customer logs into the website. The website connects to the
webservice and calls a specific procedure in the webservice. The
procedure call in turn accesses the database and performs the necessary
function. The connection to the database was setup in the
initialization code of the webservice.

I want to pass a header parameter to the webservice that allows me to
change the connection parameters in the initialization code so I can
switch to a different database per customer.

I do not want to pass connection parameter in each procedure call (over
200 procedures).
I was hoping something like SoapAddHeader or some similar command when
calling the webservice will allow me to pass the parameter to the
webbservice at a webservice connection level and not at at procedure
call level.

If my website was connecting directly to a database then I could have
used the SaaS model supplied with Webdev to achieve the above. But
because my data connection is through a webservice I am not sure how I
can achieve the same SaaS model using a webservice.

Can a webservice be published as SaaS?

I am open to any suggestions, ideas, other methods/architecture that
would allow me to to achieve the SaaS model but using webservices.

Thanks and regards

Gautam
Miembro registrado
67 mensajes
Publicado el 16,marzo 2016 - 07:30
Thanks Fabrice.

I was hoping to avoid the situation of having to pass a session identifier in each procedure call of the webservice. It would be quite a challenging task to start modifying all the +/- 200 procedures of the webservice considering that the calling routines in the websites that consume the webservice would also need to be modified.

I suppose I have no other option but thank you so much for your guidance and advise.

Gautam