Hello,
I have problems using sparql-micro-service with my own REST Service. The scenario is the following:
I have set up a REST service at localhost:8080. One of the API calls lists a number of assets as a json list. Each asset consists of a name, type and id.
Now I wanted to query the REST service using sparql-micro-services. Therefor I:
- created a service assets/assetList containing files config.ini, profile.jsonld and service.php. I edited the config.ini file according to theAPI request
----- file config.ini 8<----------------
; Service custom parameters
custom_parameter[] =
; Web API query string
api_query = "http://service:8080/SDSP-SwitchingService/SDSP/assetList"
; Maximum time (in seconds) to cache responses from the Web API. Default: 2592000 = 30 days
cache_expires_after = 2592000
; Add provenance information to the graph generated at each invocation. Default: false
add_provenance = false
----- end file 8<-------------------
Now I change the docker compose instructions so that the new service is published in the /var/www/html/sparql-ms/services and in the corese image in /sparql-micro-service/services.
In addition I add a new container to the deployment that is named service an that hosts the REST service.
I now start the deployment using docker-compose up and the containers all start with no error.
Now I use the following curl command to test the service:
curl --data-urlencode "query=SELECT * WHERE { ?s ?p ?o }" http://localhost/service/assets/assetList
The response is: Internal error: Cannot query the Web API or transform its response to JSON-LD.
I tried to access the REST service from inside the sparql-micro-service container and get the following result:
root@ba90376da655:/sparql-micro-service# curl http://service:8080/SDSP-SwitchingService/SDSP/assetList
{"assetList":[{"id":"0","name":"Trafo_0","type":"Trafo"},{"id":"1","name":"Trafo_1","type":"Trafo"},{"id":"2","name":"Trafo_2","type":"Trafo"},{"id":"3","name":"Trafo_3","type":"Trafo"},{"id":"4","name":"Trafo_4","type":"Trafo"},{"id":"5","name":"Trafo_5","type":"Trafo"},{"id":"6","name":"Trafo_6","type":"Trafo"},{"id":"7","name":"Trafo_7","type":"Trafo"},{"id":"8","name":"Trafo_8","type":"Trafo"},{"id":"9","name":"Trafo_9","type":"Trafo"}]}
Inside the log file of sms i see the same result but somehow the JSON-LD cannot be created. The error in the log file is:
Syntax error, malformed JSON.
but the json is valid.
Do you have any ideas what is going wrong here?
thanks, Christian
sms-2021-02-24.log