I need to grab a data from XML-RPC web-service.
new XmlSlurper().parse("http://host/service")
works fine, but now I have a particular service that requires basic HTTP authentication.
How can I set username and password for parse()
method, or modify HTTP headers of the request?
Using http://username:password@host/service
doesn't help - I still get java.io.IOException: Server returned HTTP response code: 401 for URL
exception.
Thanks
I found this code over here which might help?
Editing this code to your situation, we get: