Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[basyx-dev] Query on invoking Operation with REST API

Dear Basyx Developers Community,

I am Nayabrasul Shaik, working for Service Robotics Research Center at the Ulm University of Applied Sciences, Germany.
Our group is currently working on providing AAS interface to the Service Robots. We choose Basyx implementation for this purpose and appreciate your effort.


I have a query on invoking the operation using the REST interface. I am using the Cloud Edge Deployment example for this purpose.


I added an Operation(which takes a string as input and returns a string) to Submodel and tried to invoke it using Postman rest client.
The response from REST api is unsuccessful and I see the following error in Basyx.


Error from Basyx:
-------------------------
15:56:39.870 [http-nio-8082-exec-5] ERROR org.eclipse.basyx.vab.coder.json.provider.JSONProvider - Unknown Exception in JSONProvider
org.eclipse.basyx.aas.metamodel.exception.MetamodelConstructionException: Could not construct meta model element org.eclipse.basyx.submodel.metamodel.map.submodelelement.operation.OperationVariable. Passed argument was {modelType={name=OperationVariable}, value={valueId=null, kind=Template, valueType=string, modelType={name=Property}, value=foutput}}
    at org.eclipse.basyx.submodel.metamodel.map.submodelelement.operation.OperationVariable.createAsFacade(OperationVariable.java:69)
   
   

Below snippet shows the operation added to submodel:
-----------------------------------------------------------------------------

        complex.setIdShort("complex");       
        Property inProp1 = new Property("finput");
        inProp1.setModelingKind(ModelingKind.TEMPLATE);
        inProp1.setValueType(ValueType.String);
       
        Property outProp = new Property("foutput");
        outProp.setModelingKind(ModelingKind.TEMPLATE);
        outProp.setValueType(ValueType.String);
       
        complex.setInputVariables(Arrays.asList(new OperationVariable(inProp1)));
        complex.setOutputVariables(Collections.singleton(new OperationVariable(outProp)));       
               
        edgeSm.addSubmodelElement(complex);


Following is the REST API used and JSON input used for invoking the operation:
-------------------------------------------------------------------------------------------------------------

POST http://localhost:8082/oven/curr_temp/submodel/submodelElements/complex/invoke


{
"requestId" : "1",
"inputArguments": [
    {
      "value": {
        "idShort": "finput",
        "category": "string",
        "kind": "Template",
        "value": "MyInput",
        "mimeType": "string"
      }
    }
  ],
    "timeout" : 5000
}



I appreciate any cues in getting the successful response for REST API invocation of operation.
Thanks in advance.


--
Mit freundlichen Grüßen / Kind regards

Nayabrasul Shaik

Research associate
Service Robotics Research Center
University of Applied Sciences Ulm
Prittwitzstrasse 10
89075 Ulm
Germany
Telefon: +49 (0731) 50-28148
E-Mail: nayabrasul.shaik@xxxxxx


Back to the top