This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information

Call a Server Action

General questions regarding the development with ProjX.

Call a Server Action

Postby reversedr » Tue Oct 23, 2018 11:12 am

We have a "jar" file that implements the connectivity to our backend server.
We call a method of that "jar" and pass a string with the name of the class to call and an array of strings as input parameters, it then returns an array of strings as output.

What we would like to do is to add this "jar" and a ".properties" file to visionX project, and add the code necessary, so that we can execute the call from a web page and get it´s ouput.

We are evaluating visionX and we need to see if we can to this and have a working example running

Also tryed running visionX project from netbeans but i´m getting InstantiantionError java.lang.SecurityException: Invalid license!, how can i get a trial license to test it ?
reversedr
 
Posts: 9
Joined: Tue Oct 23, 2018 11:03 am

Re: Call a Server Action

Postby Support@SIB » Tue Oct 23, 2018 1:04 pm

An application, created with VisionX is a Java application. So if you have 3rd party libraries, simply add them to the classpath. So, copy your jar file to libs/server folder. Also copy the properties file to this location. It depends on the library implementation, where you search the properties file.

To call a method from your library, simply write the Java code in a server action, as described here:
http://doc.sibvisions.com/jvx/communica ... ver_action

If you write your own server action (= a simple java method), you can use the server action directly in VisionX, e.g. Use a Button and call the server action on button press. So, open the VisionX designer for your screen, right click on the button, add an action (at the bottom), and use 'Call server action'.

Please don't prefix the server action with 'get' because this is a known issue and already solved.
User avatar
Support@SIB
 
Posts: 241
Joined: Mon Sep 28, 2009 1:56 pm

Re: Call a Server Action

Postby reversedr » Tue Oct 23, 2018 1:18 pm

Ok, so i created a new screen in visionX then added a button like you said.

"So, open the VisionX designer for your screen, right click on the button, add an action (at the bottom), and use 'Call server action'."

but when i try to add a Action->Call Server Action it apears a screen "Information" that i attached as an image , and i cannot add the action
Attachments
error_call_server_action.JPG
error_call_server_action.JPG (75.26 KiB) Viewed 123 times
reversedr
 
Posts: 9
Joined: Tue Oct 23, 2018 11:03 am

Re: Call a Server Action

Postby Support@SIB » Tue Oct 23, 2018 2:27 pm

How many parameters does your server action have?

The current VisionX version has a limit to 10 parameters. This limit is only a limit for the action editor, because a user usually won't configure more than 10 parameters graphical.

Please use the workaround: Use < 10 Parameter and change the code on client and server side afterwards.

The limit is already changed in the next release.
User avatar
Support@SIB
 
Posts: 241
Joined: Mon Sep 28, 2009 1:56 pm

Re: Call a Server Action

Postby reversedr » Tue Oct 23, 2018 4:02 pm

I cannot understand what you mean by "parameters"
i only created a new screen with a button. didn´t change any code on client or server ...find below the stacktrace:

javax.rad.model.ModelException: Column name doesn't exist! - PARAMTITLE_10
at com.sibvisions.rad.model.mem.DataRow.setValue(DataRow.java:239)
at com.sibvisions.rad.model.mem.MemDataBook.setValue(MemDataBook.java:3618)
at com.sibvisions.visionx.action.ServerActionParameter.createParameterEditor(Unknown Source)
at com.sibvisions.visionx.wizards.customizer.EditActionsPage$Action.a(Unknown Source)
at com.sibvisions.visionx.wizards.customizer.EditActionsPage$Action.doValueChanged(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at javax.rad.util.EventHandler$ListenerHandler.dispatchEvent(EventHandler.java:1029)
at javax.rad.util.EventHandler.dispatchEvent(EventHandler.java:606)
at javax.rad.model.event.ModelEventHandler.dispatchEvent(ModelEventHandler.java:63)
at com.sibvisions.rad.model.mem.DataRow.setValues(DataRow.java:373)
at com.sibvisions.rad.ui.swing.ext.celleditor.JVxLinkedCellEditor$CellEditorHandler.setValuesAndClearIfNecessary(JVxLinkedCellEditor.java:430)
at com.sibvisions.rad.ui.swing.ext.celleditor.JVxLinkedCellEditor$CellEditorHandler.saveEditing(JVxLinkedCellEditor.java:447)
at com.sibvisions.rad.ui.swing.ext.JVxEditor.saveEditing(JVxEditor.java:491)
at com.sibvisions.rad.ui.swing.ext.JVxEditor.editingComplete(JVxEditor.java:626)
at com.sibvisions.rad.ui.swing.ext.celleditor.JVxLinkedCellEditor$CellEditorHandler.fireEditingComplete(JVxLinkedCellEditor.java:1073)
at com.sibvisions.rad.ui.swing.ext.celleditor.JVxLinkedCellEditor$CellEditorHandler.mouseReleased(JVxLinkedCellEditor.java:1030)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:290)
at java.awt.Component.processMouseEvent(Component.java:6535)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at java.awt.Component.processEvent(Component.java:6300)
at java.awt.Container.processEvent(Container.java:2236)
at java.awt.Component.dispatchEventImpl(Component.java:4891)
at java.awt.Container.dispatchEventImpl(Container.java:2294)
at java.awt.Component.dispatchEvent(Component.java:4713)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
at java.awt.Container.dispatchEventImpl(Container.java:2280)
at java.awt.Window.dispatchEventImpl(Window.java:2750)
at java.awt.Component.dispatchEvent(Component.java:4713)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
at java.awt.EventQueue$4.run(EventQueue.java:731)
at java.awt.EventQueue$4.run(EventQueue.java:729)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
reversedr
 
Posts: 9
Joined: Tue Oct 23, 2018 11:03 am

Re: Call a Server Action

Postby Support@SIB » Tue Oct 23, 2018 10:14 pm

We can't reproduce this problem with your steps.
We created a fresh application, an empty screen, added a Button element and tried to add the action - no problems.

Which OS do you use and which VisionX version?

In our environment, the problem occurs with a server action, with more than 10 parameters. Is it possible that you use an existing database model? In this case, if you have a database procedure/function with more than 10 parameters, the problem also occurs!

Please try a new application in the standard database!
User avatar
Support@SIB
 
Posts: 241
Joined: Mon Sep 28, 2009 1:56 pm

Re: Call a Server Action

Postby reversedr » Wed Oct 24, 2018 12:56 pm

Yes i´m using my own database and not the VisionX built in database.
and yes with VisionX built in database no error.

I managed to call our backend class with you help folowing "http://doc.sibvisions.com/jvx/communica ... ver_action"

Thank you
reversedr
 
Posts: 9
Joined: Tue Oct 23, 2018 11:03 am

Re: Call a Server Action

Postby Support@SIB » Wed Oct 24, 2018 1:04 pm

Great!

The next update release will solve the problem with max. 10 parameters. But it's always possible to call any method with Java code, without any restrictions.
User avatar
Support@SIB
 
Posts: 241
Joined: Mon Sep 28, 2009 1:56 pm

Re: Call a Server Action

Postby reversedr » Thu Oct 25, 2018 10:33 pm

Hello.

I managed to call our backend class, running the "desktop" version from eclipse, but when i try to run the "web" version in visionX the backend class isn´t called. Are there any limitations on the web version in visionX?

How can i check that our classes that we add to the project in eclipse are in the right location when running the web version in visionX?

Thank you
reversedr
 
Posts: 9
Joined: Tue Oct 23, 2018 11:03 am

Re: Call a Server Action

Postby Support@SIB » Mon Oct 29, 2018 2:18 pm

We don't know what you called and how, but there's no call-difference between desktop and web.

Please post some code snippets!
User avatar
Support@SIB
 
Posts: 241
Joined: Mon Sep 28, 2009 1:56 pm

Re: Call a Server Action

Postby Support@SIB » Mon Oct 29, 2018 2:20 pm

If you only modify the classpath in Eclipse, it has no affect on VisionX.

Simply put your lib in libs/server folder and add the jar to the classpath manually.
VisionX classloader will search jar files in the lib folder automatically!
User avatar
Support@SIB
 
Posts: 241
Joined: Mon Sep 28, 2009 1:56 pm

Re: Call a Server Action

Postby reversedr » Wed Oct 31, 2018 5:50 pm

Just found out i need to put my classes in Eclipse folder:

Java Resources->src.server for it to work.
reversedr
 
Posts: 9
Joined: Tue Oct 23, 2018 11:03 am

Re: Call a Server Action

Postby Support@SIB » Thu Nov 01, 2018 2:21 pm

That's right, src.server contains all business logic or server-side objects.
The folder src.client contains all client classes.

In case of a desktop application it's clear what's the difference between client and server. In case of a web application, client and server will be both on server-side.

But every JVx application is by default a clean 3-tier application.
User avatar
Support@SIB
 
Posts: 241
Joined: Mon Sep 28, 2009 1:56 pm


Return to Development