Giter VIP home page Giter VIP logo

Comments (4)

aaronzi avatar aaronzi commented on July 30, 2024 1

I checked the request that is being send by the UI. This is the payload for the example @wasn93 provided:

{
    "inputArguments": [
        {
            "value": {
                "modelType": "Property",
                "valueType": "xs:int",
                "idShort": "input",
                "value": "2"
            }
        },
        {
            "value": {
                "modelType": "Property",
                "valueType": "xs:int",
                "idShort": "input2",
                "value": "2"
            }
        }
    ],
    "inoutputArguments": [
        {
            "value": {
                "modelType": "Property",
                "valueType": "xs:int",
                "idShort": "inAndOut",
                "value": "2"
            }
        }
    ],
    "clientTimeoutDuration": "PT60S"
}

The request looks good to me. It seems like this is an internal bug in the basyx-java-serversdk's code.

from basyx-java-server-sdk.

mateusmolina-iese avatar mateusmolina-iese commented on July 30, 2024

Thank you for raising this issue.

Are you invoking the operations using AAS-GUI? I think this could be more of an issue of how the client is generating the request; I quickly looked at the server code and I see no restriction based on the internal Operation SubmodelElement attribute (in/inout/out).

Also, could you please provide a minimal example?

from basyx-java-server-sdk.

wasn93 avatar wasn93 commented on July 30, 2024

Thank you for looking into it.

Yes, I am using the GUI. Further I am using the Operation Delegation Example. The only modification is, that I added a second operation in the operationDelegationAAS.json. It is a copy of the original one where I set the qualifier value to my endpoint and added a second inputVariable and one inoutputVariable. The model itself is displayed correctly in the GUI.

I've attached my JSON File. The server I set up for testing looks like this. It just prints the received content and gives a static response. To run it, the localhost has to replaced by the own IP in the server and in the qualifier in the JSON file.

import json
from http.server import BaseHTTPRequestHandler, HTTPServer

serverPort = 8290
hostName = "localhost"


class OperationHttpServer(BaseHTTPRequestHandler):
    protocol_version = "HTTP/1.1"

    def do_POST(self):
        content_length = int(self.headers["Content-Length"])
        content_type = self.headers["Content-Type"]
        if content_type == "application/json":
            post_data = self.rfile.read(content_length) 
            print(post_data)
            self._send_response(200, "I am the return value")

    def _send_response(self, response_code: int, value):
        response = [{"value": {"modelType": "Property", "value": value, "valueType": "xs:string", "idShort": "result"}}]
        content = bytes(json.dumps(response), "utf-8")

        self.send_response(response_code)
        self.send_header("Content-type", "application/json")
        self.send_header("Content-length", str(len(content)))
        self.end_headers()
        self.wfile.write(content)


if __name__ == "__main__":
    webServer = HTTPServer((hostName, serverPort), OperationHttpServer)
    print("Server started http://%s:%s" % (hostName, serverPort))

    try:
        webServer.serve_forever()
    except KeyboardInterrupt:
        pass

    webServer.server_close()
    print("Server stopped.")

operationDelegationAAS.json

from basyx-java-server-sdk.

mateusmolina-iese avatar mateusmolina-iese commented on July 30, 2024

Hi @aaronzi, thanks for checking the AAS GUI output.

@wasn93, thanks for providing additional info. We will take a look at the example and get back to you as soon we have an update on the issue.

from basyx-java-server-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.