13:16, EET
September 18, 2017
Hello,
I’m using the Java SDK 2.3.2. My task is to forward a method call from my server (aka local) to a remote server.
My local server’s method has the same signature as the remote one. The method has 2 arguments: Argument1=Array of atrings, Argument2=Array of NodeId. Output argument=Array of StatusCode.
My code looks like this:
@Override
public boolean onCall(ServiceContext serviceContext, NodeId objectId, UaNode object, NodeId methodId,
UaMethod method, Variant[] inputArguments, StatusCode[] inputArgumentResults,
DiagnosticInfo[] inputArgumentDiagnosticInfos, Variant[] outputs) throws StatusException {
String sNodeId = methodId.toString();
switch (sNodeId) {
case "ns=2;i=7010":
try {
myMethod(inputArguments, inputArgumentResults, outputs);
} catch (ServiceException e) {
throw new StatusException(e.getMessage(), e.getServiceResult());
}
return true;
}
return false;
}
private void myMethod(Variant[] inputArguments, StatusCode[] inputArgumentResults, Variant[] outputs) throws MethodCallStatusException, ServiceException {
Variant[] myoutputs = this.client.call(remoteObjectId, remoteMethodId, inputArguments);
System.arraycopy(myoutputs, 0, outputs, 0, myoutputs.length);
}
}
The client is connected to the remote server. The method call is also successful on the remote server. The return values are as expected. So far everything is perfect until my method ends.
But then the toolkit checks the output arguments:
Diagnostic Info: java.lang.IllegalArgumentException: Cannot find data type of class org.opcfoundation.ua.builtintypes.StatusCode
at com.prosysopc.ua.DataTypeConverter.getDataTypesForJavaClass(Unknown Source)
at com.prosysopc.ua.server.ServiceManagerBase.dataTypeEquals(Unknown Source)
at com.prosysopc.ua.server.MethodManagerUaNode.checkOutputArguments(Unknown Source)
at com.prosysopc.ua.server.MethodManagerUaNode.callMethod(Unknown Source)
at com.prosysopc.ua.server.NodeManager.callMethod(Unknown Source)
at com.prosysopc.ua.server.NodeManagerTable.callMethod(Unknown Source)
at com.prosysopc.ua.server.NodeManagementServiceHandler.callMethod(Unknown Source)
at com.prosysopc.ua.server.NodeManagementServiceHandler.call(Unknown Source)
at com.prosysopc.ua.server.NodeManagementServiceHandler.onCall(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:498)
at org.opcfoundation.ua.application.ServiceHandlerComposition$1.serve(Unknown Source)
at org.opcfoundation.ua.application.ServiceHandlerComposition.serve(Unknown Source)
at org.opcfoundation.ua.transport.tcp.nio.OpcTcpServerSecureChannel.handleSecureMessage(Unknown Source)
at org.opcfoundation.ua.transport.tcp.nio.OpcTcpServerConnection.handleSecureMessage(Unknown Source)
at org.opcfoundation.ua.transport.tcp.nio.OpcTcpServerConnection$4.onMessageComplete(Unknown Source)
at org.opcfoundation.ua.transport.tcp.nio.SecureInputMessageBuilder.fireComplete(Unknown Source)
at org.opcfoundation.ua.transport.tcp.nio.SecureInputMessageBuilder.setMessage(Unknown Source)
at org.opcfoundation.ua.transport.tcp.nio.SecureInputMessageBuilder$1.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
I want my local server return the same output values as the remote server does.
What can I do?
All the nodes in the address space are created using a node set file and calling UaServer.getAddressSpace().loadModel(stream).
Thomas
P.S. Sorry but the title contains the wrong exception name. It’s an IllegalArgumentException but not NullPointerException!
16:20, EET
April 17, 2013
Hi Thomas,
Thank you for a very good issue report. The Java SDK seems to be missing the class mapping for StatusCode datatype. Thanks for noticing! I’ll put this into our issue tracker and we’ll integrate the fix into next release version.
Until official fix, you can make a workaround by setting the Java class yourself in the server application:
a suitable place for setting this is for example right after calling UaServer.init();
Let us know if the workaround works for you or if you still have any further questions.
Most Users Ever Online: 1919
Currently Online:
17 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Heikki Tahvanainen: 402
hbrackel: 144
rocket science: 88
pramanj: 86
Francesco Zambon: 83
Ibrahim: 78
Sabari: 62
kapsl: 57
gjevremovic: 49
Xavier: 43
Member Stats:
Guest Posters: 0
Members: 730
Moderators: 7
Admins: 1
Forum Stats:
Groups: 3
Forums: 15
Topics: 1529
Posts: 6471
Newest Members:
toneylapham544, rondawolinski7, Marypof5711, roycedelargie91, kourtneyquisenbe, ellis87832073466, zkxwilliemae, gabriellabachus, Deakin, KTP25ZofModerators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1032, Jimmy Ni: 26, Matti Siponen: 349, Lusetti: 0
Administrators: admin: 1