I tried for :
def baseURL = "correct url since post man works " ;
def url = new java.net.URL(baseURL);
def requestMethod = "POST";
URLConnection connection = url.openConnection();
connection.setRequestProperty("Authorization", "Basic copied from postman, it is correct");
connection.setRequestMethod(requestMethod);
connection.setRequestProperty("Content-Type", "application/xml");
connection.setRequestProperty("Accept", "application/xml");
connection.connect();
For me:
connection.setRequestMethod(requestMethod);
gives me a problem saying that method: setRequestMethod could not be found.
I tried rest client as well, there exception gets raised but does not throw exact error
Kindly help for same.