Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with Invokable Operation for File Input in Submodel #309

Open
inowshin19 opened this issue Jun 7, 2024 · 6 comments
Open

Issue with Invokable Operation for File Input in Submodel #309

inowshin19 opened this issue Jun 7, 2024 · 6 comments

Comments

@inowshin19
Copy link

I am trying to use an invokable operation for file input in my Submodel using Postman. My Submodel and its element is defined as follows:

{
  "paging_metadata": {},
  "result": [
    {
      "modelType": "Submodel",
      "kind": "Instance",
      "id": "TestOrchestrator",
      "category": "TestCategory",
      "description": [
        {
          "language": "de-DE",
          "text": "TestOrchestrator"
        }
      ],
      "displayName": [
        {
          "language": "de-DE",
          "text": "TestOrchestrator"
        }
      ],
      "idShort": "TestOrchestrator",
      "submodelElements": [
        {
          "modelType": "Operation",
          "inputVariables": [
            {
              "value": {
                "modelType": "File",
                "contentType": "application/json",
                "idShort": "aasFile"
              }
            }
          ],
          "idShort": "AASUpload"
        }
      ]
    }
  ]
}

I am sending a POST request via Postman to the endpoint:

http://localhost:8081/submodels/VGVzdE9yY2hlc3RyYXRvcg/submodel-elements/AASUpload/invoke?async=false

The form-data and response is given below:

GithubIssue_FileInvokable

Is file not supported for input? Please let me know if I am doing something wrong.

Thank you very much in advance!

@aaronzi
Copy link
Contributor

aaronzi commented Jun 7, 2024

Thank you for submitting this issue.
We will look into it and get back to you with a solution.

@zhangzai123
Copy link
Contributor

Hi @inowshin19 ,
the invokable operation is developed by the Basyx SDK, it is not included in the AAS4j or AAS standard, so you cannot create an invokable operation using a Json file. Here is an example to create an invokable operation

From your provided information I understand that you want to upload an AAS defined in the opc2aasServiceAAS.json.
The best way to upload an AAS ist to use the follow HTTP REST API:
POST {server-url}/shells
body: serialized AAS as Json
see here

@inowshin19
Copy link
Author

Hello @zhangzai123, thank you for the clarification!

@zhangzai123
Copy link
Contributor

Hi @inowshin19,
I have tested your settings in a Junit test. The test runs through without error. It may because of the usage of the Postman that you got the 415 error.

@gongzhq136
Copy link

I also came cross a problem regarding invokable operation. I create a submodel using createSubmodelWithAllSubmodelElements and create the submodel in SubmodelRepository with the createSubmodel method. After this I got error when I execute the operation, no matter via web-ui (got 405 Error) or via invoke API (got NotInvokableException).

However, if i create the submodel via the SubmodelRepository instance which returned from appContext.getBean(SubmodelRepository.class), it works indeed.

Hi @inowshin19 , the invokable operation is developed by the Basyx SDK, it is not included in the AAS4j or AAS standard, so you cannot create an invokable operation using a Json file.

Is it now possible to create a submodel in submodelrepository component which supports invokable operation directly, rather than through operation delegation? Please let me know if I'm missing something. Much appreciated!

@mateusmolina-iese
Copy link
Contributor

Hi @gongzhq136,

invoking operations directly without the operation delegation feature is currently not supported.

I'll add your suggestion to the backlog for future consideration 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants