如果端点是 https,是否使用 HTTPS
Is HTTPS used if the end point is a https
我有一个可以向端点发出 SOAP 请求的客户端。结束点以 https
开头,但在客户端中没有使用 HttpsURLConnection
。我想问一下,SOAP请求会不会因为端点是https,所以还是会用TLS发送?
客户端实现:
String endPoint = "https://some_endpoint";
SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();
SOAPConnection soapConnection = soapConnectionFactory.createConnection();
SOAPMessage soapRequest = //create the soap req.
SOAPMessage soapResponse = soapConnection.call( soapRequest, endPoint);
事实上,如果其 URL 以 https 开头,它确实 HTTPSURLConnection,无需特别说明。
If URL= https://someexample.org //its by default HTTPSURLConnection
If URL=http://someexample.org //its by default HTTPURLConnection
使用下面的代码来证明它在幕后确实如此。
使用 http URL 在下面执行一次,然后使用 https URL 再次执行相同的代码。在这两种情况下,它的工作原理都是一样的。这意味着,它在后台执行 HTTPSURL连接。
String endPoint = "https://someURL.mockable.io";
SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();
SOAPConnection soapConnection = soapConnectionFactory.createConnection();
String soapString = "<soap:Envelope xmlns:soap=\"http://www.w3.org/2001/12/soap-envelope\" "
+ "soap:encodingStyle=\"http://www.w3.org/2001/12/soap-encoding\"><soap:Body xmlns:m=\"http://www.example.org/stock\">"
+ "<m:GetStockPriceResponse><m:Price>34.5</m:Price></m:GetStockPriceResponse></soap:Body></soap:Envelope>";
InputStream is = new ByteArrayInputStream(soapString.getBytes());
SOAPMessage request = MessageFactory.newInstance().createMessage(null, is);
SOAPMessage soapResponse = soapConnection.call(request, endPoint);
System.out.println(soapResponse);
我有一个可以向端点发出 SOAP 请求的客户端。结束点以 https
开头,但在客户端中没有使用 HttpsURLConnection
。我想问一下,SOAP请求会不会因为端点是https,所以还是会用TLS发送?
客户端实现:
String endPoint = "https://some_endpoint";
SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();
SOAPConnection soapConnection = soapConnectionFactory.createConnection();
SOAPMessage soapRequest = //create the soap req.
SOAPMessage soapResponse = soapConnection.call( soapRequest, endPoint);
事实上,如果其 URL 以 https 开头,它确实 HTTPSURLConnection,无需特别说明。
If URL= https://someexample.org //its by default HTTPSURLConnection
If URL=http://someexample.org //its by default HTTPURLConnection
使用下面的代码来证明它在幕后确实如此。
使用 http URL 在下面执行一次,然后使用 https URL 再次执行相同的代码。在这两种情况下,它的工作原理都是一样的。这意味着,它在后台执行 HTTPSURL连接。
String endPoint = "https://someURL.mockable.io";
SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();
SOAPConnection soapConnection = soapConnectionFactory.createConnection();
String soapString = "<soap:Envelope xmlns:soap=\"http://www.w3.org/2001/12/soap-envelope\" "
+ "soap:encodingStyle=\"http://www.w3.org/2001/12/soap-encoding\"><soap:Body xmlns:m=\"http://www.example.org/stock\">"
+ "<m:GetStockPriceResponse><m:Price>34.5</m:Price></m:GetStockPriceResponse></soap:Body></soap:Envelope>";
InputStream is = new ByteArrayInputStream(soapString.getBytes());
SOAPMessage request = MessageFactory.newInstance().createMessage(null, is);
SOAPMessage soapResponse = soapConnection.call(request, endPoint);
System.out.println(soapResponse);