# Servoy as webservice client

**URL:** <https://forum.servoy.com/t/servoy-as-webservice-client/15433>\
**Category:** Classic Servoy\
**Created:** [January 31, 2012, 8:53am UTC](https://forum.servoy.com/t/servoy-as-webservice-client/15433 "2012-01-31T08:53:44Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Janssenjos](https://avatars.discourse-cdn.com/v4/letter/j/ee7513/32.png) [@Janssenjos](https://forum.servoy.com/u/Janssenjos)\
**Post date:** [January 31, 2012, 8:53am UTC](https://forum.servoy.com/t/servoy-as-webservice-client/15433/1 "2012-01-31T08:53:44Z")

</div>

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 ![:)]( "Smile") )

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?

---

<div class="post-metadata">

**Author:** ![ptalbot](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/ptalbot/32/4952_2.png) [@ptalbot](https://forum.servoy.com/u/ptalbot)\
**Post date:** [January 31, 2012, 2:48pm UTC](https://forum.servoy.com/t/servoy-as-webservice-client/15433/2 "2012-01-31T14:48:41Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![Janssenjos](https://avatars.discourse-cdn.com/v4/letter/j/ee7513/32.png) [@Janssenjos](https://forum.servoy.com/u/Janssenjos)\
**Post date:** [February 1, 2012, 11:31am UTC](https://forum.servoy.com/t/servoy-as-webservice-client/15433/3 "2012-02-01T11:31:26Z")

</div>

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/](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:

```auto
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.

---

<div class="post-metadata">

**Author:** ![ptalbot](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/ptalbot/32/4952_2.png) [@ptalbot](https://forum.servoy.com/u/ptalbot)\
**Post date:** [February 1, 2012, 1:12pm UTC](https://forum.servoy.com/t/servoy-as-webservice-client/15433/4 "2012-02-01T13:12:47Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Janssenjos](https://avatars.discourse-cdn.com/v4/letter/j/ee7513/32.png) [@Janssenjos](https://forum.servoy.com/u/Janssenjos)\
**Post date:** [February 1, 2012, 1:36pm UTC](https://forum.servoy.com/t/servoy-as-webservice-client/15433/5 "2012-02-01T13:36:43Z")

</div>

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?)

---

<div class="post-metadata">

**Author:** ![ptalbot](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/ptalbot/32/4952_2.png) [@ptalbot](https://forum.servoy.com/u/ptalbot)\
**Post date:** [February 1, 2012, 1:42pm UTC](https://forum.servoy.com/t/servoy-as-webservice-client/15433/6 "2012-02-01T13:42:25Z")

</div>

> 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.

---

<div class="post-metadata">

**Author:** ![Janssenjos](https://avatars.discourse-cdn.com/v4/letter/j/ee7513/32.png) [@Janssenjos](https://forum.servoy.com/u/Janssenjos)\
**Post date:** [February 1, 2012, 1:51pm UTC](https://forum.servoy.com/t/servoy-as-webservice-client/15433/7 "2012-02-01T13:51:15Z")

</div>

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/](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?

---

<div class="post-metadata">

**Author:** ![ptalbot](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/ptalbot/32/4952_2.png) [@ptalbot](https://forum.servoy.com/u/ptalbot)\
**Post date:** [February 1, 2012, 1:57pm UTC](https://forum.servoy.com/t/servoy-as-webservice-client/15433/8 "2012-02-01T13:57:53Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Janssenjos](https://avatars.discourse-cdn.com/v4/letter/j/ee7513/32.png) [@Janssenjos](https://forum.servoy.com/u/Janssenjos)\
**Post date:** [February 2, 2012, 5:22pm UTC](https://forum.servoy.com/t/servoy-as-webservice-client/15433/9 "2012-02-02T17:22:17Z")

</div>

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?)

```auto
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();

```
