Invoking Web Services

Hi all,

Is there any plugins or beans or any other technique available to invoke a web service inside a Servoy method?

Any response regarding the above would be highly appreciated.

Thanks,
Acer

maybe this helps: http://forum.servoy.com/viewtopic.php?t=2166

Yep, there is a soap plug-in somewhere out there.
It was made by Paul Bakker when he did not work for Servoy yet.
I don’t have it (anymore) so I can not help you but maybe someone else can…

patrick:
maybe this helps: http://forum.servoy.com/viewtopic.php?t=2166

Thanks Patrick,

But in this post the attached file is no more available. :?:

Thanks,
Acer

This one is ok: http://downloads.servoy.com/thirdparty/ … rvices.zip

Thanks Marcel,

I have downloaded and used in a sample Solution. I have used the same sample Dutch AdressValidation WebService.

But i am getting the error,

org.mozilla.javascript.JavaScriptException: java.lang.NoClassDefFoundError: javax/xml/rpc/encoding/Deserializer

Thanks,
Acer

Hmm, did you add the axis lib to the plugins folder?

Hi Marcel,

I Have added the axix lib to the plugins folder. But now i am getting a different Error.

Please, see the attached file.

Thanks,
Acer

That one is cryptic.
You probably entered a null value to the plug-in.
Nothing in the log?

Log Entries :

ConversionError: The undefined value has no properties calling getWSInfo. (webServices; line 7) book_text.webServices
at com.servoy.j2db.scripting.e.call(Unknown Source)
at com.servoy.j2db.develop.debugger.k.a(Unknown Source)
at com.servoy.j2db.develop.debugger.k.executeFunction(Unknown Source)
at com.servoy.j2db.FormController.a(Unknown Source)
at com.servoy.j2db.FormController.executeFunction(Unknown Source)
at com.servoy.j2db.FormController.actionPerformed(Unknown Source)
at com.servoy.j2db.FormController$a.actionPerformed(Unknown Source)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

Thanks,
Acer

Can you show your code?
No guarantees though, we don’t have the source of the plug-in…

Thanks Marcel for being with me in the discussion.

Here is the code to get the Web Service Info.

//Get the available Methods for a WebService location or parameters for a specific Method

WSURL = 'http://62.212.78.36/cgi-bin/WagAddressServerSingle.exe/wsdl/IWagAddressServerSingle';

var methods = plugins.Kydome_WebServices.getWSInfo(WSURL, null);


var methodsArray = methods.split('\n');
var noneSelected = 0;
if (methodsArray.length != 1.0)
	{
	var selectedMethod = plugins.dialogs.showSelectDialog('Available Methods','Select one of the Methods:',methodsArray);
	if ( selectedMethod == '' )
		{
		noneSelected = 1;
		}
	}
else
{
if (methodsArray[0].substr(0,5) == 'Error')
	{
		plugins.dialogs.showInfoDialog('Error',methodsArray[0],'OK');
		return;
	}
else 
	{
		var selectedMethod = methodsArray[0];
	}
}

if ( noneSelected == 1 )
	{
	return;
	}
else
	{
	var params = plugins.PBS_DynamicWSClient.getWSInfo(WSURL,selectedMethod);
				
	var title = 'WS Parameters for Method: '+ selectedMethod;
	var showResult = plugins.dialogs.showInfoDialog(title,params,'OK','Create Code');
	if ( showResult == 'Create Code' )
		{
		var paramsString = '//Create and fill the input array\n';
		paramsString += 'var params = new Array;\n';
		paramsString +=	"params[0] = '" + WSURL + "'; //Webservice URL\n";
		paramsString +=	"params[1] = '" + selectedMethod + "'; //Method\n";
		paramsString +=	"params[2] = 10*1000; //Time Out Value\n"
		var paramsArray = params.split('\n');
		for ( var i = 0 ; i < paramsArray.length ; i++ )
			{
			paramsString +=	"params[" + (i+3) + "] = ''; //" + paramsArray[i].substring(paramsArray[i].indexOf('parameter: Name = ',1)+18) + "\n";
			}
		paramsString +=	"//Invoke the webservice\n";
		paramsString +=	"var output = plugins.PBS_DynamicWSClient.InvokeWSClient(params);";
		application.setClipboardContent(paramsString);
		plugins.dialogs.showInfoDialog('Info','Code created and copied to clipboard','OK')
		}
	}

Thanks,
Acer

OK, the error is thrown here: ```
var params = plugins.PBS_DynamicWSClient.getWSInfo(WSURL,selectedMethod);

1. there is no method getWSInfo (maybe name is misspelled)
2. you don't have the correct WSURL (url) set
3. the selectedMethod array has a null value in the array

IT2Be:
OK, the error is thrown here: ```
var params = plugins.PBS_DynamicWSClient.getWSInfo(WSURL,selectedMethod);

1. there is no method getWSInfo (maybe name is misspelled)
2. you don't have the correct WSURL (url) set
3. the selectedMethod array has a null value in the array

That “PBS_DynamicWSClient” should be “Kydome_WebServices”, the Plugin itself.

I have changed that, but the error persits.

Thanks,
Acer

So, what about the other points?

It sounds a bit as this

plugins.PBS_DynamicWSClient

is invalid, so the plugin is not loaded (plugins.PBS_DynamicWSClient = undefined). Do you see the plugin in the method editor?

The methods in the above code is also comming null.

Thanks,
Acer

I think you have to do some interpretation here.

From what you say I guess the plugin sample code is older than the plugin so names and methods have changed.

patrick:
It sounds a bit as this

plugins.PBS_DynamicWSClient

is invalid, so the plugin is not loaded (plugins.PBS_DynamicWSClient = undefined). Do you see the plugin in the method editor?

Hi Patrick,

I didnot see the PBS_DynamicWSClient in the method editor.

In getting the sample code for the Kydome_WebServices Plugin, i found the PBS_DynamicWSClient. I thought that, it will be wrongly misspelled, that’s why i have changed that.

still, it is not working.

Thanks,
Acer

So how does the code look like now and where do you get what error?