Comments (5)
Hi Christian, good one. I did not know it is possible to pass this charset within the Content-Type header.
So clearly this is a bug, easily identifiable in module frmichel/sparqlms/commonUtils.php, function getSparqlQuery().
If you want a quick and dirty fix, you can connect to the container and change the code in /sparql-micro-service/src/common/Utils.php. But of course this will be lost every time you restart the container. At least you'll know if that fixes the pb.
Here is the new code of the function. I've written it quickly but did not test it... so it may not work straight away. It replaces the internal switch with an if-then-else using str_contains.
static public function getSparqlQuery()
{
$method = $_SERVER['REQUEST_METHOD'];
switch ($method) {
case 'GET':
{
if (array_key_exists('query', $_GET))
$sparqlQuery = $_GET['query'];
else
self::httpBadRequest("SPARQL query with HTTP GET method but no 'query' argument.");
break;
}
case 'POST':
{
if (array_key_exists('CONTENT_TYPE', $_SERVER))
$contentType = $_SERVER['CONTENT_TYPE'];
else
self::httpBadRequest("SPARQL query with HTTP POST method but no 'Content-Type' header.");
if (str_contains($contentType, 'application/x-www-form-urlencoded')) {
if (array_key_exists('query', $_POST))
$sparqlQuery = $_POST['query'];
else
self::httpBadRequest("SPARQL query with HTTP POST method and Content-Type' application/x-www-form-urlencoded' but no 'query' argument.");
break;
} else if (str_contains($contentType, 'application/sparql-query')) {
$sparqlQuery = file_get_contents('php://input');
break;
} else
self::httpBadRequest("SPARQL query with HTTP POST method but unexpected 'Content-Type': " . $contentType);
break;
}
default:
self::httpMethodNotAllowed("Unsupported HTTP method " . $method);
}
return $sparqlQuery;
}
I'll need a bit more time to test it, commit and publish a new version of the Docker image. I guess you have already produced your own version of the Docker image so you may put this change into it.
I'm pretty busy these coming days and weeks, I'll try to find a moment to do that. Meanwhile, if you try that let me know if that works.
from sparql-micro-service.
from sparql-micro-service.
Hi Frank
The solution you provided solved the problem. Thanks for your help,
Christian
from sparql-micro-service.
Ok great, thx for the hint. I've still not taken time to test it further and commit it and all. I let you know when the image is updated.
from sparql-micro-service.
Hi @kleegrewec, just to let you know, I've commited the fix and published a new release + updated Docker image v0.5.4.
from sparql-micro-service.
Related Issues (20)
- Document rewriting rules for HTML doc generation HOT 1
- Support for multiple values of an argument in ServiceDescription mode HOT 1
- cache_expires_after doesn't work HOT 1
- Nested calls to micro-services don't work HOT 2
- Implement paging of results from Web API
- Generate provenance information HOT 1
- SPARQL Microservice behind proxy HOT 4
- Federated recursive query HOT 13
- Improve documentation HOT 2
- Support for multiple values of a custom parameter on the http query string HOT 1
- Allow different strategies for passing multiple values to the Web API HOT 1
- No triples are generated if file construct.sparql is not present HOT 1
- Support Web API with no parameter HOT 1
- Problem parsing json response of HOT 9
- Problem testing docker deployment HOT 25
- discussion: a similar project HOT 1
- How to test queries from remote HOT 7
- Error with GoogleMaps API
- Error in re-injecting parameters in the graph HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sparql-micro-service.