Quantcast
Channel: Pentaho Community Forums - BI Platform
Viewing all articles
Browse latest Browse all 2893

Pentaho Webservie PUT call is giving (HTTP Status 405 - Method Not Allowed) error

$
0
0
I am new to both pentaho and web service. I need to do a PutMethod call to Pentaho with HTTPClient and update a MetaData file to it's repository. I am able to get the file using GetMethod but when i am calling the PutMethod it is giving me (HTTP Status 405 - Method Not Allowed)


My code is as follows


import org.apache.commons.httpclient.*;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.methods.PutMethod;


public void PutRequest(String context, String data, String filePath, String userName, String tenantName) {


File file = new File(filePath);


urlParams = GenerateParam(userName, tenantName);


try {
logger.debug("PUT : " + url.toExternalForm() + "/" + context + "/" + data + urlParams);
logger.debug("File Path :: " + file.getAbsolutePath());


PutMethod putMethod = new PutMethod(url.toExternalForm() + "/" + context + "/" + data + urlParams);
putMethod.setDoAuthentication(true);


Part[] parts = { new StringPart("domainId", data), new StringPart("overwrite", "true"),
new FilePart("metadataFile", file, "application/octect-stream", "utf-8") };


putMethod.setRequestEntity(new MultipartRequestEntity(parts, putMethod.getParams()));


int status = client.executeMethod(putMethod);
logger.debug("PUT status : " + status);
logger.debug("Response : " + putMethod.getResponseBodyAsString());
logger.debug("File : " + file.getName());
putMethod.releaseConnection();
// file.delete();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}










Please let me know what is wrong with this code.

Viewing all articles
Browse latest Browse all 2893

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>