views:

334

answers:

0

The groovy own library for XML-RPC does not support basic authorization. I try to use httBuilder ( http://groovy.codehaus.org/modules/http-builder/home.html ) build on top of HttpComponents http://hc.apache.org/) to access TRAC via XML-RPC.

def postBody = """
 <?xml version="1.0"?>
<methodCall>
<methodName>wiki.getPage</methodName>
<params>
<param><string>WikiStart</string></param>
</params>
</methodCall>
  """ 

def http = new HTTPBuilder('https://blablaserver.com/xml-rpc')
http.auth.basic ("user", "password")
http.post( headers: [Accept: 'application/xml'], body: postBody ) { response, reader ->

 response.success = { resp ->
   println resp.statusLine
 } 
}

All I get is

Exception in thread "main" groovyx.net.http.HttpResponseException: Not Found
 at groovyx.net.http.HTTPBuilder.defaultFailureHandler(HTTPBuilder.java:609)

Any ideas how to send the XML-RPC parameters the right way ?

(btw, the authorization works, setting wrong password will create an auth error)