Skip to content
Advertisement

Tag: https

How to convert https url to File in Java?

I have an https url which is of String format. How can I convert it to File? I tried this but I’m getting error – URI scheme is not “file” Answer FileUtils.copyURLToFile worked well for me. Reference – https://commons.apache.org/proper/commons-io/apidocs/org/apache/commons/io/FileUtils.html#copyURLToFile-java.net.URL-java.io.File-

Quotation marks in Camel Content-Type header

I am trying to invoke a SOAP service using camel-http4. This service requires me to send the following header: Content-Type: application/soap+xml;charset=UTF-8;action=”ListBerichten”. I have to include the quotation marks, or otherwise the service will return a 400 code When I try this with a client like Postman or SoapUI or curl it works fine, but when I try it with Camel,

Trusted SSL certificate showing as self signed

I have a trusted TLS certificate deliverd by DigiCert that I’m trying to use in a java/spring application exposing rest apis. I created a .p12 file with openssl doing the following : openssl pkcs12 -export -in mycertificate.cer -certfile mycertificate_INTERMEDIATE.cer -inkey myprivate_key.key -out myCert.p12 I am able to use this file in my application to access the app through https with

Including a .pem certificate in a Java HTTP request

I am currently able to access a web service that requires a client certificate using the following curl command: curl -k -v –cert ./certificate.pem https://api.com/unit How do I make this request in a Java application? Notice that I need the -k flag which allows curl to make “insecure” SSL connections. This needs to be done in the Java application as

Advertisement