Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [basyx-dev] Operation invoke problem

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

 

--

Frank Schnicke

Expert »Industrie 4.0 System Architectures«

Dept. Virtual Engineering

 

Fraunhofer IESE

Fraunhofer-Platz 1 | 67663 Kaiserslautern

+49 631 6800-2259

frank.schnicke@xxxxxxxxxxxxxxxxxx

www.iese.fraunhofer.de

 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

25 Jahre Fraunhofer IESE  –  Engineering the Digital Future

Reisen Sie mit uns in die Vergangenheit, aber vor allem in die digitale Zukunft!

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

 

Von: basyx-dev <basyx-dev-bounces@xxxxxxxxxxx> Im Auftrag von Laack, Markus van
Gesendet: Montag, 7. Juni 2021 11:19
An: basyx-dev@xxxxxxxxxxx
Betreff: [basyx-dev] Operation invoke problem

 

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


Back to the top