<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"><channel><category>pcsoft.fr.windev</category><copyright>Copyright 2026, PC SOFT</copyright><lastBuildDate>10 May 2019 16:01:31 Z</lastBuildDate><pubDate>10 May 2019 16:01:31 Z</pubDate><description>Bonjour,&#13;
J'aimerai fair eun appel a un web service  rest qui demande une authentification.&#13;
en java aucun souci. Je n'arrive malheureusement pas reproduire mon code java en windev ?&#13;
&#13;
quelqu'un pour m'aider. Voici le code merci a tous&#13;
&#13;
&#13;
&#13;
String https_url = "https://wsbexpress.dhl.com/rest/sndpt/ShipmentRequest";&#13;
URL url;&#13;
String Json_content = "{un_json}";&#13;
&#13;
url = new URL(https_url);&#13;
HttpsURLConnection con = (HttpsURLConnection)url.openConnection();&#13;
String username="username";&#13;
String password="password";&#13;
byte[] message = (username+":"+password).getBytes("UTF-8");&#13;
String authEncoded = javax.xml.bind.DatatypeConverter.printBase64Binary(message);&#13;
&#13;
con.setRequestMethod("POST");&#13;
con.setRequestProperty("User-Agent", USER_AGENT);&#13;
con.setRequestProperty("Accept-Encoding", "gzip,deflate");&#13;
con.setRequestProperty("Content-Type", "application/json");&#13;
con.setRequestProperty("Authorization", "Basic "+authEncoded);				&#13;
	&#13;
con.setDoOutput(true);&#13;
&#13;
// faire la demande&#13;
OutputStream reqStream = con.getOutputStream();&#13;
reqStream.write(Json_content.getBytes());&#13;
&#13;
// lire la réponse&#13;
StringBuilder responseSB = new StringBuilder();&#13;
BufferedReader br = new BufferedReader(new InputStreamReader(con.getInputStream()));&#13;
String line;&#13;
while ( (line = br.readLine()) != null)&#13;
	responseSB.append(line);&#13;
&#13;
// Close streams&#13;
br.close();&#13;
reqStream.close();</description><ttl>30</ttl><generator>WEBDEV</generator><language>fr_FR</language><link>https://forum.pcsoft.fr/es-ES/pcsoft.fr.windev/230058-connexion-web-service-securiser/read.awp</link><title>connexion a un web service securiser</title><managingEditor>moderateur@pcsoft.fr (El moderador)</managingEditor><webMaster>webmaster@pcsoft.fr (El webmaster)</webMaster></channel></rss>
