Hi Frank,
thank you for your reply and explanation regarding the example. Considering this it indeed makes sense to not be able to push executable code onto a remote server.
Maybe enabling this feature considering an authentication with a certain certificate, as Thomas suggested, could be an interesting topic for further development (thank you as well for your input, Thomas), but for my use-case
it is fine for now to predefine the runtime behavior on their own server.
Therefore, I had a look at the cloudedgedeployment example and indeed I can invoke (from the client application) the Operation now that is part of the Edge Submodel.
However, I still receive an error afterwards on both the client and server application, even though the operation is executed successfully!!!
The error message printed in the client console even looks the same to me as the one I had in my initial attempt (HelloWorld example).
Still the client crashes after the execution, while the server application (CloudEdgeDeploymentScenario.java) does not.
Client:
Exception in thread "main"
org.eclipse.basyx.vab.exception.provider.ProviderException:
[HTTP POST] Failed to request http://localhost:8082/oven/curr_temp/submodel with mediatype application/json;charset=UTF-8
Server:
[http-nio-8082-exec-8] ERROR o.e.b.v.c.j.p.JSONProvider - Unknown Exception in JSONProvider
java.util.NoSuchElementException:
null
Is there still a point I miss/do wrong to invoke an operation?
Best regards
Markus van Laack
Von: basyx-dev <basyx-dev-bounces@xxxxxxxxxxx>
Im Auftrag von Thomas.Kuhn@xxxxxxxxxxxxxxxxxx
Gesendet: Montag, 14. Juni 2021 11:07
An: basyx-dev@xxxxxxxxxxx
Betreff: Re: [basyx-dev] Operation invoke problem
Hi Frank,
spannend wäre es natürlich wenn wir das pushen von Code von autorisierten Hosts zulassen. Diese könnten sich ja mit einem Zertifikat ausweisen…
LG, Thomas
-------------------------------------------
Dr. Thomas Kuhn
Division Manager Embedded Systems
Fraunhofer IESE
Fraunhofer-Platz 1 | 67663 Kaiserslautern | Germany
Phone: +49 631 / 6800- 2177 | Fax: +49 631 / 6800-1199
www.iese.fraunhofer.de
Email:
Thomas.Kuhn@xxxxxxxxxxxxxxxxxx
Dear Markus,
the code in the Hello World Example is pushing the defined submodel to a remote AAS server. Pushing a Submodel with runtime code right now is not supported due to security concerns – however, the
error message could be clearer here. I’m taking a note on improving the message in this case.
To enable your use case, you can easily host submodels with runtime behavior on their own server. How to do this is showcased in
https://wiki.eclipse.org/BaSyx_/_Scenarios_/_Cloud_Edge_Deployment.
The code of this example is found in basyx.examples in the org.eclipse.basyx.examples.scenarios.cloudedgedeployment package.
Best regards,
Frank
Dear BaSyx Developer,
I’m Markus van Laack working for the Fraunhofer IEG. We are planning to use BaSyx within our project and I’m currently doing my first steps and tests with it.
One requirement I am trying to get to work is to invoke a defined Operation. The goal for later will be to call a local Python script but for now I’m just trying to be able to invoke an Operation at all.
As a fist start I took the “Hello_World” example and added an Operation to the Server.java as it is explained in the Step 3 of the Introductory Examples.
I’ve extended the code of the Server.java by the following lines to create my Operation and to add it to the Documentation Submodel:
// Function to become Operation
Function<Object[], Object>
runModel = (argus)
-> {
System.out.println("Hello");
return
null;
};
// Create Operation
Operation
runModelOperation =
new Operation(runModel);
// Set ID of the operation
runModelOperation.setIdShort(OPID);
// Add the operation to the
Submodel
documentationSubmodel.addSubmodelElement(runModelOperation);
Inside the Client.java I’ve just added the following lines to the bottom to retrieve and to invoke the new Operation:
ISubmodel
submdl =
manager.retrieveSubmodel(Server.OVENAASID,
Server.DOCUSMID);
IOperation
runMdlOperation =
submdl.getOperations().get(Server.OPID);
System.out.println(runMdlOperation.getIdShort());
// This line works and prints the ID short
runMdlOperation.invoke();//
This line fails
But when executing the invoke I face the following error message:
Exception in thread "main"
org.eclipse.basyx.vab.exception.provider.ProviderException: [HTTP POST] Failed to
request
http://localhost:4001/aasServer/shells/eclipse.basyx.aas.oven/aas/submodels/documentationSm/submodel with mediatype application/json;charset=UTF-8
In fact the line above is still working and printing out the ID short in the Console, so I assume that the Operation was successfully created and added to the Docu Submodel, but I don’t see why I cannot invoke it?!
I’m looking forward hearing from you.
Best regards and thank you for your time.
Markus van Laack