[ 
https://issues.apache.org/jira/browse/JENA-759?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14090470#comment-14090470
 ] 

Andy Seaborne edited comment on JENA-759 at 8/8/14 8:39 AM:
------------------------------------------------------------

Does the strabon endpoint deal with content negotiation correctly?

You can set the Accept header with 
{{((QueryEngineHTTP)qe).setSelectContentType(...)}}. If this is the core issue, 
you might want to raise with the strabon developers.  Experimenting, I found it 
does not accept "q=" modifiers, nor any content type except 
{{application/sparql-results+xml}}, nor a list for "Accept".  Judging by the 
error messages, it looks like the code takes the string value exactly and 
checks it is {{application/sparql-results+xml}}.

http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.7
now
http://tools.ietf.org/html/rfc7231#page-60

The error code woudl better be 406.  Sending back 
{{application/sparql-results+xml}} anyway ("default representation") is 
possible.

They do accept HTTP GET.

On the issue with using Fuseki - error code 400 does not necessarily mean it's 
the same thing occurring in both situations. There are very limited numbers of 
error codes.  If the Fuseki server is quite old, it might not do the content 
negotiation correctly but this is fixed.  Please raise a separate JIRA with a 
complete, minimal example.



was (Author: andy.seaborne):
Does the strabon endpoint deal with content negotiation correctly?

You can set the Accept header with 
{{((QueryEngineHTTP)qe).setSelectContentType(...)}}. If this is the core issue, 
you might want to raise with the strabon developers.  Experimenting, I found it 
does not accept "q=" modifiers, nor any content type except 
{{application/sparql-results+xml}}.

http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.7
now
http://tools.ietf.org/html/rfc7231#page-60

The error code is 406, sending back {{application/sparql-results+xml}} anyway 
("default representation") is possible.

On the issue with using Fuseki - error code 400 does not necessarily mean it's 
the same thing occurring in both situations. There are very limited numbers of 
error codes.  If the Fuseki server is quite old, it might not do the content 
negotiation correctly but this is fixed.  Please raise a separate JIRA with a 
complete, minimal example.


> New Version of HTTP client throw HTTP400 error when using "sparqlService"
> -------------------------------------------------------------------------
>
>                 Key: JENA-759
>                 URL: https://issues.apache.org/jira/browse/JENA-759
>             Project: Apache Jena
>          Issue Type: Bug
>          Components: ARQ
>    Affects Versions: Jena 2.12.0
>         Environment: OS : Ubuntu
> Using eclipse, maven and Junit.
>            Reporter: ArthurVaisse-Lesteven
>            Priority: Critical
>              Labels: ARQ, HTTP, SPARQL, errorCode, remote
>             Fix For: Jena 2.11.1
>
>
> Call to a remote strabon SPARQL endpoint that was working on Jena 2.11.1 do 
> not work properly in version 2.12.0.
> This function : 
> {noformat}
> public void queryStrabon(final String query, final RDFDatatype datatype, 
> final String... parameters) {
>         final QuerySolutionMap map = new QuerySolutionMap();
>         System.out.println(query);
>         for (int i = 0; i < parameters.length; i += 2) {
>             final RDFNode node = 
> ResourceFactory.createTypedLiteral(parameters[i + 1], datatype);
>             map.add(parameters[i], node);
>         }
>         final ParameterizedSparqlString pss = new 
> ParameterizedSparqlString(query, map);
>         final QueryExecution qe = 
> QueryExecutionFactory.sparqlService(this.endpointURL + "Query", 
> pss.asQuery());
>         final ResultSet resultSet = qe.execSelect();
>         while (resultSet.hasNext()) {
>             System.out.println(resultSet.next());
>         }
>         System.out.println("lines: " + resultSet.getRowNumber());
>     }
> {noformat}
> while working on Jena 2.11.1 do not work on Jena 2.12.0 and got the following 
> stack trace at execution time :
> {noformat}
> HttpException: 400
>       at 
> com.hp.hpl.jena.sparql.engine.http.HttpQuery.rewrap(HttpQuery.java:414)
>       at 
> com.hp.hpl.jena.sparql.engine.http.HttpQuery.execGet(HttpQuery.java:358)
>       at com.hp.hpl.jena.sparql.engine.http.HttpQuery.exec(HttpQuery.java:295)
>       at 
> com.hp.hpl.jena.sparql.engine.http.QueryEngineHTTP.execSelect(QueryEngineHTTP.java:346)
>       at 
> model.SpatioTemporalModelSTrabonEndpointImpl.getInterestingEvents(SpatioTemporalModelSTrabonEndpointImpl.java:99)
>       at 
> model.SpatioTemporalModelStrabonEndpointImplTest.Test_get_interesting_events0(SpatioTemporalModelStrabonEndpointImplTest.java:86)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>       at java.lang.reflect.Method.invoke(Method.java:606)
>       at 
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
>       at 
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
>       at 
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
>       at 
> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
>       at 
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
>       at 
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
>       at 
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
>       at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
>       at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
>       at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
>       at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
>       at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
>       at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
>       at 
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
>       at 
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>       at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
>       at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
>       at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
>       at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
> {noformat}
> Additionaly, the server says that the query isn't set or is invalid.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to