Servoy as webservice client

Hi,

I’m looking into the option of consuming webservices in our servoy webclient.
Now I’ve searched the forum, but the topics I found about this were in 2009. (When I also looked into this :) )

For consuming a soap webservice, the only thing i found is the Kydome WebServices plugin. (Or writing your own plugin, what we don’t want to do except if there is no other option)

Now i’m curious if there were any new plugin/method developments for this in the past years?

There are webservices and webservices…

Some use SOAP, some use REST, some plain HTML response, XML or JSON… take your pick.

So there’s no final answer to your question: it all depends on the web services you are targeting.

For REST, you can roll your own implementation in Servoy using the http plugin.
For SOAP, the Kydome can work for simple web services but will fail as soon as the SOAP response contains composite objects.

In this case (which is very likely when it comes to SOAP), you will need to use Axis (for example) to create wrapper objects for these composite SOAP objects. Then you will be able to use them in Java (so in a plugin).

Ok thanks.

I’m also looking into calling a .Net dll trough the servoyguy com plugin. I see you are involved there, so maybe you can help me out with the following problem:
When I try to call my dll with ‘getNewClientJSCOM’ I get the following error:

I looked around on the internet, and I found a tutorial abouth Jacob. http://www.dreamincode.net/forums/topic/114094-using-dll-library-in-java-application-using-jacob/. They have a sample .net dll here, which I registered on my machine (i can find it in the registry) and which I try to use to call in servoy (Com.dll). But then the error show’s up.

In servoy i have the following code:

if (!plugins.servoyguy_servoycom.isJACOBInstalled()){
		plugins.dialogs.showErrorDialog( "Error", "Jacob is not installed.");
		return;
	}
	
	var com = plugins.servoyguy_servoycom.getNewClientJSCOM("Com.Calculation");
	if (!com || !com.isJACOBLoaded()){
		plugins.dialogs.showErrorDialog( "Error", "Error loading COM: \n" + plugins.servoyguy_servoycom.getLastError());
		return;
	}

Searching around on the internet about this error, doesn’t really point somewhere.
Maybe you see something I am doing wrong here? (By the way, is there more documentation abouth the plugin, besides the example solution?)

thanks.

First, did you uninstall any older version of the plugin?

Also, if you did install the jacob.xxx.dll in your System folder, did you get rid of it? (you might have jacob dll conflicts otherwise)

  • the new version of the plugin on ServoyForge (v1.1.3) automatically deploys the correct dll in your user.home/.servoy/ folder.

Otherwise, this can come from a variety of reasons, but the main one is a difference in architecture between java and the dll.
If you run Java 32-bit, you can only use 32-bit dll. If you run 64-bit, you can only run 64-bit dll. That’s also why Jacob itself comes in 32 or 64-bit.
Depending on the java architecture, the plugin will deploy the correct one.

Thanks,

Well the dll is build for x86 and the development server is x86, so i think that should be fine.
I did not install the jacob dll in the system folder, so I suppose it is deployed by the plugin in the servoy folder. (The 3 examples in the sample_solution work, so I suppose that the jacob.dll is installed fine.)

You mean version v.1.1.2? I don’t see any 1.1.3 version of the plugin on servoyForge?

So it still not works, then probably the com interfaces on the dll are wrong? (aren’t there any examples for this with an external com dll, instead of windows com objects?)

Janssenjos:
Thanks,

Well the dll is build for x86 and the development server is x86, so i think that should be fine.
I did not install the jacob dll in the system folder, so I suppose it is deployed by the plugin in the servoy folder. (The 3 examples in the sample_solution work, so I suppose that the jacob.dll is installed fine.)

You mean version v.1.1.2? I don’t see any 1.1.3 version of the plugin on servoyForge?

So it still not works, then probably the com interfaces on the dll are wrong? (aren’t there any examples for this with an external com dll, instead of windows com objects?)

You are right, 1.1.2, sorry.
But if the sample solution works. then this means something’s wrong with this dll.
I don’t know of any sample dll no coming from MS. Try googling for it.

Well I googled for it, and found the following example: http://www.dreamincode.net/forums/topic/114094-using-dll-library-in-java-application-using-jacob/
This is also the example on which I based my test in servoy.

But it is an example to use in Java code. Does the servoy-com plugin implement Jacob in the same way?

Basically yes (although with more care to possible Exceptions), but this example dates from July 2009 and Jacob has been updated since, so this might not work with the new version.

Ok, thanks.

I’m a step further now, i succeeded in creating a JSCom object.
Now I would like to know if the following would be possible:

I have a method ‘DoWork’ on the Manager class. Can in pass in the Args & Args2 object as a parameter somehow?
(And perhaps get an args3 object back as result?)

var Manager = plugins.servoyguy_servoycom.getNewClientJSCOM("Com.Test.Manager");
	if (!Manager || !Manager.isJACOBLoaded()){
		plugins.dialogs.showErrorDialog( "Error", "Error loading COM Manager: \n" + plugins.servoyguy_servoycom.getLastError());
		return;
	}
	
	var Args = plugins.servoyguy_servoycom.getNewClientJSCOM("Com.Test.Args");
		
	if (!Args || !Args.isJACOBLoaded()){
		plugins.dialogs.showErrorDialog( "Error", "Error loading COM Args: \n" + plugins.servoyguy_servoycom.getLastError());
		return;
	}

var Args2 = plugins.servoyguy_servoycom.getNewClientJSCOM("Com.Test.Args2");
		
	if (!Args2 || !Args2.isJACOBLoaded()){
		plugins.dialogs.showErrorDialog( "Error", "Error loading COM Args2: \n" + plugins.servoyguy_servoycom.getLastError());
		return;
	}
		
	Args.put("Name","A");
	Args.put("Number",1);
	Args2.put("Misc", 3);
	
	var result = Reportmanager.call("DoWork", Args, Args2);
	
	Args.release();
	Args2.release();
	Manager.release();