I have developed a web application where I use a POST webservice from my HTML page with AngularJS to post a variable in my java class. I use this variable to update my graph in a Fuseki RDF store that I have. For some reason I get a "java.lang.ClassNotFoundException:org.apache.http.protocol.HttpContext" error and my update sparql query doesn't execute, even though my query is correct as I have tried it directly through the sparql endpoint and it works and I don't use HttpContext in my code at all.

The relevant code is below:

           @Path("/WebS_res")

            public class GetInput {
            @POST
            @Path("/results")
            @Consumes({"application/json"})

    public void createResults(@FormParam("variable") String stringvariable ){

        UpdateRequest request = UpdateFactory.create("INSERT DATA { GRAPH <http://example/graph>{ "+ stringvariable + "}}");
        UpdateProcessor processor = UpdateExecutionFactory.createRemote(request, "http://endpoint/sparql");
        processor.execute();
.....

While my JS function for calling the web service in my HTML page is:

$scope.PostData = function () {

    $http({
            method : 'POST',
            url : 'http://mydomain:8080/project/REST/WebS_res/results',
            data : $.param({
                    'variable' :$scope.variable, 

            }),
            headers : {
                'Content-Type' : 'application/json'
            }
        }).success(function (data) {
            console.log(' data '+$scope.variable);

        });

};

I don't understand why it's trying to find the HttpContext class since I don't use it? I downloaded the relevant jar and then it showed another error needing another class, and I downloaded that jar as well and then it showed an error saying org.apache.jena.atlas.web.HttpException: 415 Unsupported: application/sparql-update So I have no idea!

Any help would be appreciated thank you.

0

There are 0 answers