Plugin 4: dynamic WebService Invoker

Questions and answers on developing, deploying and using plugins and JavaBeans

Moderators: bcusick, edward, BDuncan, Jan Blok

Plugin 4: dynamic WebService Invoker

Postby pbakker on Mon Jun 14, 2004 4:37 pm

Here's publically available plugin number 4 for Servoy (if I kept count correctly :) ).

This plugin is a Dynamic WebService Invoker. This means the following:
With the plugin, it's possible to invoke WebServices, without having to hardcode information about the webservices into the plugin.

The invocation takes an Array as parameter and the Array can contain as many entries as a specific WebService needs (see samplecode).

The plugin also provides a function to describe the webservice for you, so you know what type of parameters the WebService needs (see sample code).

The plugin comes with a full example how to invoke and proces the result of a Dutch AdressValidation WebService (see sample code).

For more info on WebServices in general, have a look at www.xmethods.com
For more info on the example WebService used, check out: www.wagbill.com

This plugin is based on Axis 1.1 SOAP Libraby. The library is supplied with the plugin in the zipfile. Just extract the zipfile in the Servoy\Plugin directory (keep subdirectories). Please read the license file in the Servoy\Plugin\Axis directory after unzipping.

For more information on this plugin, move the samplecode on the About function.

This plugin is provided "as is" and free of charge. Feel free to ask questions, report bugs or ask for features.

Currently, the invokation needs an internet connection (to the location of the WebService) on the computer where the client runs. For a future release I'll plan to provide a InvokeWSServer function as well.

Enjoy....

Paul
Attachments
DynWebServiceClient_RC2.zip
(1.99 MiB) Downloaded 65 times
Last edited by pbakker on Fri Aug 20, 2004 7:16 pm, edited 2 times in total.
pbakker
 
Posts: 1797
Joined: Wed Oct 01, 2003 7:12 pm
Location: Amsterdam, the Netherlands

Postby Jan Aleman on Tue Jun 15, 2004 7:56 am

Cool stuff!
More and more services are being offered as a webservice, this is the future of server to server communication!
Jan Aleman
Servoy
Jan Aleman
 
Posts: 1669
Joined: Wed Apr 23, 2003 8:49 pm
Location: Planet Earth

Postby pbakker on Tue Jun 15, 2004 2:33 pm

I have uploaded a new version (beta3), which has a bugfix for the getWSInfo function.

Beta2 whould only show one result when getting the methods for a specific WebService location, even if there were multiple methods.

This is fixed in beta3.

Paul
pbakker
 
Posts: 1797
Joined: Wed Oct 01, 2003 7:12 pm
Location: Amsterdam, the Netherlands

Postby pbakker on Fri Aug 20, 2004 7:27 pm

Hi,

Just posted RC2.

Previous versions would go into error when passing a null value as a parameter. This is fixed.

Also, the SampleCode of the getWSInfo function is more advanced. It will give you a ready-to-run method. If you fill in the URL you want to get info for, the code will let you select for which method you want it and then give you the opertunity to copy the neseccary code for invoking the method to the ClipBoard. The only thing you have to do is paste the clipboard content into a method, set the values and you're ready to go.

Enjoy,

Paul

PS. I anticipate that I have to change the name of the plugin and the class of the plugin within 1 or 2 months :( This will mean that in your methods, you would have to update the reference.
Luckely Servoy has a Search and Replace option, making this a piece of cake :D

For example:

plugins.PBS_DynamicWSClient.InvokeWSClient(params);

would have to change into:

plugins.xxxxxxx_DynamicWSClient.InvokeWSClient(params);

When the new name is clear, I will also release a more advanced version, including Server side invocation.
pbakker
 
Posts: 1797
Joined: Wed Oct 01, 2003 7:12 pm
Location: Amsterdam, the Netherlands

Postby sabeenah on Tue Mar 22, 2005 6:33 pm

I am very interested in this plugin.
Where can I download it from?
Sabina Borlea
sabeenah
 
Posts: 44
Joined: Mon Apr 19, 2004 11:52 am
Location: Timisoara, Romania

Postby pbakker on Wed Mar 23, 2005 11:41 am

If you give me your email adres, I'll email it to you.

Paul
pbakker
 
Posts: 1797
Joined: Wed Oct 01, 2003 7:12 pm
Location: Amsterdam, the Netherlands

Postby pbakker on Tue May 02, 2006 10:31 am

Hi All,

An updated version of the Dynamic WebService invoker plugin is downloadable from the following URL:

http://downloads.servoy.com/thirdparty/ ... rvices.zip

Download the zipfile and unzip it in the plugins directory of Servoy, keeping the subdirectories that are in the zipfile.

Since the previous version of the plugin, the namiing of the plugin and the functions has changed, allthough the functionality remains pretty much the same. So, if you want to upgrade to this version, you need to adjust the naming in your code.

I did add the ability to invoke the webservice through the server.

Feel free to ask questions and/or report issues. I'll try to answer/solve them, allthough there's no official support for the plugin.

Having said that: We have been using this plugin in our production environment for over 2 years now, without problems.

The plugin is provided free of charge and as is.

Regards,

Paul Bakker
pbakker
 
Posts: 1797
Joined: Wed Oct 01, 2003 7:12 pm
Location: Amsterdam, the Netherlands

Postby MerMer on Thu May 11, 2006 3:25 pm

As well as using external webservices can Servoy provide a webservice itself to broadcast content onto other websites.?

For instance by using XML_RPC or SOAP and callling a Servoy method in order to return the appropriate data as a webservice to external websites.

MerMer
MerMer
 
Posts: 96
Joined: Fri Oct 28, 2005 3:48 pm
Location: Notitingham, UK

Postby pbakker on Thu May 11, 2006 3:30 pm

I know it's on Servoy's ToDo list, but no idea for what version.

I've been playing around with it, got some basic stuff up and running, but nothing I could publish.

So, it's doable :)

Maybe, if I get around to it one day, I'll extend the plugin to enable methods through WebServices, but it won't be shortly...

Paul
pbakker
 
Posts: 1797
Joined: Wed Oct 01, 2003 7:12 pm
Location: Amsterdam, the Netherlands

Postby ngervasi on Fri May 12, 2006 12:14 pm

MerMer wrote:As well as using external webservices can Servoy provide a webservice itself to broadcast content onto other websites.?

For instance by using XML_RPC or SOAP and callling a Servoy method in order to return the appropriate data as a webservice to external websites.

MerMer


You can do this (or sort of) using the headless client: just call a jsp page from a browser passing parameters if you need to and receiving the result as HTML, I use this to generate a map (html table) of a wharehouse directly on servoy server (it's faster), have a look at the jsp:

Code: Select all
<%@ page import = "java.util.*" %>
<%@ page import = "com.servoy.j2db.server.headlessclient.*" %>
<%@ page import = "com.servoy.j2db.dataprocessing.IDataSet" %>
<%@ page errorPage="errorpage.jsp" %>
<%
   ISessionBean servoy_hc = (ISessionBean)session.getAttribute("servoy");
   if (servoy_hc == null)
   {
      servoy_hc = HeadlessClientFactory.createSessionBean(request,"SprintEngine","username","password");
      session.setAttribute("servoy",servoy_hc);
   }
   boolean ok = servoy_hc.setMainForm("Magazzino");
   
   if (!ok)
   {
      out.print("error cannot work on required form");
      return;
   }

%>
<%
    String result="";
   
    result= (String)servoy_hc.executeMethod(null,"hcGeneraMappa",null);
   
    out.println(result);
   
    session.setAttribute("servoy", null);
%>


And here's the method hcGeneraMappa invoked by the jsp page:

Code: Select all
//Map init
var mappa = hcInizializzaMappa();

...
...

return mappa;


Hope you can get the idea.
ngervasi
 
Posts: 704
Joined: Tue Dec 21, 2004 11:47 am
Location: Arezzo, Italy

Postby MerMer on Fri May 12, 2006 2:31 pm

As I was thinking through the problem last night the headless client occured to me and you've answered my next question - many thanks.

What is the performance like of the headless client? Can it scale?

MerMer
MerMer
 
Posts: 96
Joined: Fri Oct 28, 2005 3:48 pm
Location: Notitingham, UK

Postby ngervasi on Fri May 12, 2006 5:27 pm

It is considerably faster than doing the same operation on a remote smart client, basically an HC is a smart client which runs directly on the server so there is no overhead due to the network. Faster the server hardware faster the headless client.
In my case I had to generate an HTML table representing a warehouse and color the cells based on the space left on the shelves (red, yellow, green), this involves a lot of sql queries to calculate the right color for each table cell. Same procedure, on remote smart client (PPC G5 dual2000): 45+ secs, on headless client (Servoy server on Dual Pentium3 1000): 8 secs.

Quite impressive, uh? :wink:
Attachments
Wharehouse_map.png
Wharehouse_map.png (45.37 KiB) Viewed 616 times
ngervasi
 
Posts: 704
Joined: Tue Dec 21, 2004 11:47 am
Location: Arezzo, Italy

Postby MerMer on Mon May 15, 2006 2:15 pm

Nicola,

Impressive use of the technology. Thanks for sharing. How about scale? Could you application serve 100's of simultaneous users?

MerMer
MerMer
 
Posts: 96
Joined: Fri Oct 28, 2005 3:48 pm
Location: Notitingham, UK

Postby ngervasi on Mon May 15, 2006 4:20 pm

Scaling is a strange beast.
The map calculation involves a lot of queries to determine the cell color based on the available slots in the shelves so I think that faster hardware and a separate DB server should allow to scale without problems. Keep in mind that my DB (mysql) and Servoy server are both running on a quite old machine (Pentium3 2x1000), using two separate server like Pentium4 or whatever should allow a lot more speed in this kind of process.

To give you an idea these are the queries needed to build the map on my development machine (Dual PPC G5 2000mhz, servoy developer, mysql 4.1.14), the whole process took less than 4 seconds:

Code: Select all
Total Time (mm:ss:ms)   Count   Avg Time (mm:ss:ms)   SQL Statement
00:01:371   1373   00:00:000   select bancali.bancaliid, bancali.id_ubicazione, bancali.data_creazione from bancali where bancali.id_ubicazione = ? order by bancali.bancaliid
00:00:687   242   00:00:002   select ubicazione.ubicazioneid from ubicazione where (ubicazione.settore = ? and ubicazione.fila = ? ) order by ubicazione.ubicazioneid
00:00:085   74   00:00:001   select ubicazione.settore, ubicazione.ubicazioneid, ubicazione.ubicazione, ubicazione.slot, ubicazione.fila, ubicazione.livello from ubicazione where ubicazione.ubicazioneid in (?,?,?,?,?,?,?,?,?)
00:00:029   22   00:00:001   select ubicazione.settore, ubicazione.ubicazioneid, ubicazione.ubicazione, ubicazione.slot, ubicazione.fila, ubicazione.livello from ubicazione where ubicazione.ubicazioneid in (?,?,?,?,?,?,?,?)
00:00:027   25   00:00:001   select ubicazione.settore, ubicazione.ubicazioneid, ubicazione.ubicazione, ubicazione.slot, ubicazione.fila, ubicazione.livello from ubicazione where ubicazione.ubicazioneid in (?,?,?,?,?,?)
00:00:027   19   00:00:001   select ubicazione.settore, ubicazione.ubicazioneid, ubicazione.ubicazione, ubicazione.slot, ubicazione.fila, ubicazione.livello from ubicazione where ubicazione.ubicazioneid in (?,?,?,?,?,?,?,?,?,?,?,?)
00:00:006   5   00:00:001   select ubicazione.settore, ubicazione.ubicazioneid, ubicazione.ubicazione, ubicazione.slot, ubicazione.fila, ubicazione.livello from ubicazione where ubicazione.ubicazioneid in (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
00:00:003   2   00:00:001   select ubicazione.settore, ubicazione.ubicazioneid, ubicazione.ubicazione, ubicazione.slot, ubicazione.fila, ubicazione.livello from ubicazione where ubicazione.ubicazioneid in (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
00:00:002   1   00:00:002   select sg.group_id,sg.group_name from servoy_groups sg,servoy_user_groups sug where sg.group_id = sug.group_id and sug.user_id = ? order by sg.group_name
00:00:002   2   00:00:001   select ubicazione.settore, ubicazione.ubicazioneid, ubicazione.ubicazione, ubicazione.slot, ubicazione.fila, ubicazione.livello from ubicazione where ubicazione.ubicazioneid in (?,?,?,?)
00:00:002   1   00:00:002   select ubicazione.ubicazioneid from ubicazione order by ubicazione.ubicazioneid
00:00:001   1   00:00:001   select ubicazione.settore, ubicazione.ubicazioneid, ubicazione.ubicazione, ubicazione.slot, ubicazione.fila, ubicazione.livello from ubicazione where ubicazione.ubicazioneid in (?,?)
00:00:001   2   00:00:000   select ubicazione.settore, ubicazione.ubicazioneid, ubicazione.ubicazione, ubicazione.slot, ubicazione.fila, ubicazione.livello from ubicazione where ubicazione.ubicazioneid in (?,?,?)
00:00:001   1   00:00:001   select ubicazione.settore, ubicazione.ubicazioneid, ubicazione.ubicazione, ubicazione.slot, ubicazione.fila, ubicazione.livello from ubicazione where ubicazione.ubicazioneid in (?,?,?,?,?)
ngervasi
 
Posts: 704
Joined: Tue Dec 21, 2004 11:47 am
Location: Arezzo, Italy

Postby jetmuzer on Fri Jan 11, 2008 9:06 pm

Great plugin, thanks!
music sound much music music new
jetmuzer
 
Posts: 1
Joined: Wed Jan 09, 2008 7:26 pm


Return to Plugins and Beans

Who is online

Users browsing this forum: No registered users and 0 guests