X-CGP-ClamAV-Result: CLEAN X-VirusScanner: Niversoft's CGPClamav Helper v1.25a (ClamAV 0.103.8/26900) X-Junk-Score: 0 [] X-KAS-Score: 0 [] Return-Path: Received: from mail-02.1984.is ([185.112.145.70] verified) by post.selbstdenker.com (CommuniGate Pro SMTP 6.3.18) with ESMTPS id 30743818 for webobjects-dev@wocommunity.org; Mon, 08 May 2023 19:16:54 +0200 Received-SPF: none receiver=post.selbstdenker.com; client-ip=185.112.145.70; envelope-from=hugi@karlmenn.is Received: from localhost by mail-02.1984.is with esmtp (Exim 4.94.2) (envelope-from ) id 1pw4TL-00Dfxe-Uy for webobjects-dev@wocommunity.org; Mon, 08 May 2023 17:16:33 +0000 From: Hugi Thordarson Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Subject: Re: [WO-DEV] Https request examples? Date: Mon, 8 May 2023 17:16:27 +0000 References: To: WebObjects & WOnder Development In-Reply-To: Message-Id: X-Mailer: Apple Mail (2.3696.120.41.1.1) X-Spam-Score: -0.0 (/) X-Authenticated-User: hugi@karlmenn.is X-Sender-Address: hugi@karlmenn.is Hi Markus, is the server using a self-signed certificate? If not, i.e. it's just = good ol' https with a cert issued by a trusted CA, you should be fine = using the build in java http client with https, something like=E2=80=A6 ----------------------- public static String post( final String url, final String requestBody ) = throws IOException, InterruptedException { // Create a client (the client can be reused so for performance = sensitive code, I wouldn't do this within the method) final HttpClient client =3D HttpClient .newBuilder() .build(); // Construct a request to submit final HttpRequest request =3D HttpRequest .newBuilder() .uri( URI.create( url ) ) .POST( BodyPublishers.ofString( requestBody, = StandardCharsets.UTF_8 ) ) .build(); // Submit the request final HttpResponse response =3D client.send( request, = HttpResponse.BodyHandlers.ofString( StandardCharsets.UTF_8 ) ); return response.body(); } ----------------------- - hugi > On 8 May 2023, at 14:34, Markus Ruggiero (rucotec) = wrote: >=20 > I need to make a https POST request to a 3rd party web server sending = xml along in the body of the request. The server is supposed to return a = html page which I should then display inside an iFrame. >=20 > Does any body have some example code how to do such an https request? = Easy to create the xml but I am not quite sure about the SSL/TLS part. >=20 > Thanks a lot > ---markus--- >=20