Note that there are some explanatory texts on larger screens.

plurals
  1. POGrails RESTFUL web service api
    primarykey
    data
    text
    <p>I am currently developing a web app which should do restful service calls to existing web service api.</p> <p>What I have is the base URL and the API names.</p> <p>Any help on how do I start working on it? I suppose I need to use httpbuilder for the base url I have, then followed by /api name. But how do I test it on grails if its working?</p> <p>When I paste the base url on the browser it does return some xml information, so what I need is to do it on grails instead.</p> <p>XML response when I paste the url through browser</p> <pre><code>&lt;ns1:createNewUserResponse&gt; &lt;userId&gt;21&lt;/userId&gt; &lt;/ns1:createNewUserResponse&gt; </code></pre> <p>So I need to be able to get this response through my web-app (grails) instead of pasting it on the browser.</p> <p>EDIT* this is a good example I found useful</p> <pre><code>@Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.5.0-RC2' ) import groovyx.net.http.* import static groovyx.net.http.ContentType.* import static groovyx.net.http.Method.* def http = new HTTPBuilder( 'http://ajax.googleapis.com' ) // perform a GET request, expecting JSON response data http.request( GET, JSON ) { uri.path = '/ajax/services/search/web' uri.query = [ v:'1.0', q: 'Calvin and Hobbes' ] headers.'User-Agent' = 'Mozilla/5.0 Ubuntu/8.10 Firefox/3.0.4' // response handler for a success response code: response.success = { resp, json -&gt; println resp.statusLine // parse the JSON response object: json.responseData.results.each { println " ${it.titleNoFormatting} : ${it.visibleUrl}" } } // handler for any failure status code: response.failure = { resp -&gt; println "Unexpected error: ${resp.statusLine.statusCode} : ${resp.statusLine.reasonPhrase}" } } </code></pre> <p>but i do not understand the query part and how do I alter it to my need? the URL I have contains credential of username and password, the response should return a securityToken which I need to get it out from the results. Any help would be greatly appreciated!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload