Hi! In Java Callout, I tried to include the java keystore file (.jks) to overcome the SSLHandShakeException but I was not able to deploy API bundle, It shows some server exception. Similarly how to read the properties in config. file in Java Callout? Please Advise. Thanks.
Answer by berraquera · Jul 03, 2015 at 04:46 PM
Dear @P.Ganesan, for security reasons reading files from the filesystem is not allowed from Java Callout policy. However, you can still leverage Java streams to read text or binary files stored in jar files. For a full api proxy example, please leverage the following tutorial. Let me know how it goes! Cheers!
InputStream fstream = this.getClass().getResourceAsStream("/templates/stockTemplate.xml"); //read stockTemplate.xml as a class from classpath StringWriter writer = new StringWriter(); IOUtils.copy(fstream, writer, "UTF-8"); String theString = writer.toString(); messageContext.setVariable("stockTemplateFileContent", theString); //assign file content to stockTemplateFileContent variable messageContext.setVariable("response.content", theString); // assign file content to response.content variable return ExecutionResult.SUCCESS;
It would be very useful to be able to read files from the proxy resources directory, and if it was possible to store a wider range of file types in the resources folder
The variable reference request.queryparam.email in java callout property is not working. 2 Answers
What version and type of Java Jar files are loaded? 2 Answers
Failed to instantiate the JavaCallout Class 1 Answer
JavaCallout error "Failed to instantiate the JavaCallout Class apigee.test.TestJavaProject" 3 Answers
Java callouts limitations. Difference between Cloud customers and Private Cloud customers. 2 Answers