Hello Mr. Shaik,
thank you for your message.
I think the exception you are getting is caused
by a slightly wrong body you use for your request.
The correct body should look like this:
{
"requestId" : "1",
"inputArguments": [
{
"value": {
"idShort": "finput",
"valueType": "string",
"value": "MyInput",
"modelType": {
"name":
"Property"
}
}
}
],
"timeout" : 5000
}
Some of the content of “value” needs to be
slightly different to what you had.
I hope this helps.
Kind regards
Maximilian Conradi
--
Maximilian Conradi
Software Architect
Dept. Virtual Engineering
Fraunhofer
IESE
Fraunhofer-Platz
1 | 67663 Kaiserslautern
+49
631 6800 2278
maximilian.conradi@xxxxxxxxxxxxxxxxxx
www.iese.fraunhofer.de
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Von:
basyx-dev <basyx-dev-bounces@xxxxxxxxxxx>
Im Auftrag von Nayabrasul Shaik
Von:
basyx-dev <basyx-dev-bounces@xxxxxxxxxxx>
Im Auftrag von Nayabrasul Shaik
Gesendet: Dienstag, 16. November 2021 16:28
An: basyx-dev@xxxxxxxxxxx
Betreff: [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