简体   繁体   中英

Issue while using SOAP UI for Marklogic SPARQL REST API

I am trying to configure SOAP UI to access Marklogic RDF data through REST API.

The example in ML api is given in curl as:

curl --anyauth --user admin:admin -i -X POST \
--data-binary @./booktitle.sparql \
-H "Content-type:application/sparql-update" \
-H "Accept:application/sparql-results+xml" \
http://localhost:8000/v1/graphs/sparql

So in Soap UI 4.6.4 I have added two headers:

Accept: application/rdf+xml
Content-Type: application/sparql-query

and content type as application/sparql-query

Added the query.sparql file as attachment having query as below:

#file name query.sparql
PREFIX db: <http://dbpedia.org/resource/>
PREFIX onto: <http://dbpedia.org/ontology/>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX xs: <http://www.w3.org/2001/XMLSchema#>    

        SELECT ( CONCAT(?G, " ", ?S) AS ?name )
    WHERE  { db:A._J._Langer foaf:givenName ?G ; foaf:surname ?S }

And in the authentication tab provided the username and password and have tried with basic and preemptive authentication. But while hitting the POST request getting following error:

2015:ERROR:org.apache.http.client.ClientProtocolException
   org.apache.http.client.ClientProtocolException
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:822)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:754)
    at com.eviware.soapui.impl.wsdl.support.http.HttpClientSupport$Helper.execute(HttpClientSupport.java:238)
    at com.eviware.soapui.impl.wsdl.support.http.HttpClientSupport.execute(HttpClientSupport.java:348)
    at com.eviware.soapui.impl.wsdl.submit.transports.http.HttpClientRequestTransport.submitRequest(HttpClientRequestTransport.java:318)
    at com.eviware.soapui.impl.wsdl.submit.transports.http.HttpClientRequestTransport.sendRequest(HttpClientRequestTransport.java:232)
    at com.eviware.soapui.impl.wsdl.WsdlSubmit.run(WsdlSubmit.java:123)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
   Caused by: org.apache.http.client.NonRepeatableRequestException: Cannot retry request with a non-repeatable request entity.
    at org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:611)
    at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:454)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:820)
    ... 11 more

And http log of soap ui says:

Fri Mar 20 11:46:53 IST 2015:DEBUG:<< "<error-response xmlns='http://marklogic.com/xdmp/error'>[\n]"
Fri Mar 20 11:46:53 IST 2015:DEBUG:<< "  <status-code>401</status-code>[\n]"
Fri Mar 20 11:46:53 IST 2015:DEBUG:<< "  <status>Unauthorized</status>[\n]"
Fri Mar 20 11:46:53 IST 2015:DEBUG:<< "  <message>401 Unauthorized</message>[\n]"
Fri Mar 20 11:46:53 IST 2015:DEBUG:<< "</error-response>[\n]"

Although with the same settings I am able to see response with HttpRequester(Firefox).

Do I need to do some additional settings in soap ui.

What app server are you using?

if its the app-services one (port 8000) you need to be using digest authentication.

You could change it to basic to make it easier, it would be less secure but if this isn't for production you should be fine.

just go to your admin cp (port 8001) on the left nav bar go to groups -> default -> app servers -> app-Services (or whatever the server is you want to change) then look for the authentication dropdown and change it to basic or application-level (if you do application level you'll have to set the default user to the one you want to test with)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM