eclipse-aaspe/server

InternalServerError GET /submodels/{id}/submodel-elements/{idshortpath}/attachment

cbiehl30 opened this issue · 2 comments

The server returns 500 InternalServerError when requesting GET /submodels/{id}/submodel-elements/{idshortpath}/attachment:

{
  "messages": [
    {
      "code": "InternalServerError",
      "correlationId": null,
      "messageType": "Error",
      "text": "AASX Package New Package not opened. Aborting!",
      "timestamp": "02/21/2024 12:00:19"
    }
  ]
}

Steps for reproducing:

  1. Create a submodel via POST /submodels
{
  "idShort": "abc",
  "id": "123",
  "submodelElements": [
    {
      "idShort": "def",
      "typeValueListElement": "File",
      "value": [
        {
          "idShort": "some_pdf",
          "contentType": "application/pdf",
          "modelType": "File"
        }
      ],
      "modelType": "SubmodelElementList"
    }
  ],
  "modelType": "Submodel"
}
  1. Send a file to PUT /submodels/MTIz/submodel-elements/def.some_pdf/attachment
  2. GET /submodels/MTIz/submodel-elements/def.some_pdf/attachment

I'm using the docker version as described in the readme. Is there something I am doing wrong maybe?

Hi @cbiehl30,

As per the current implementation, there has to be an AASX Package available for a supplementary file to be added to the package (Put /.../attachement).

From the step 1 to reproduce the issue, I assume, the sumodel is not being added to any partifular AAS as well.

To resolve this issue, please follow below steps:

  1. Create an AAS, if already not available.
  2. Create a submodel to the AAS using an API " Post /submodels" (screenshot 1 in the end) and provide the aasIdentifier from step 1.
  3. Download the AASX Package using the API "Get /packages/{packageId}" (screenshot 2). This step will create an AASX Package. If you are using Blazor version of the server, you will find the package id as per the screenshot 3. In this screenshot "MA" is the already encoded packageId. For simplicity, you can also click on the link from the blazor UI, to download the package.
  4. Now, upload a file to the submodel.

Screenshot 1:
image

Screenshot 2:
image

Screenshot 3:
image

@juileetikekar Thank you for explaining, it works the way you described it