java 访问sharepointonline(STS)得到token的方法

方法1: 通过httpclient直接访问,

方法2:通过soapclient连接

方法3:研究中。。。


方法2实装:

                InputStreamfis = SoapClient.class.getResourceAsStream("SALM.xml");

                SOAPMessagerequest = MessageFactory.newInstance().createMessage(null, fis);

                URLendpoint = new URL("https://login.microsoftonline.com/extSTS.srf");

                SOAPConnectionFactorysoapConnectionFactory = SOAPConnectionFactory.newInstance();

                SOAPConnectionconnection = soapConnectionFactory.createConnection();

                SOAPMessageresponse = connection.call(request, endpoint);

                connection.close();

                SOAPBodybody = response.getSOAPBody();

                NodeListlist = body.getElementsByTagNameNS("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd","BinarySecurityToken");

                StringtokenInfo = list.item(0).getTextContent();


代理的情况需要定义:

        System.getProperties().setProperty("https.proxyHost", "xxx");
        System.getProperties().setProperty("https.proxyPort", "xxxx");



你可能感兴趣的:(java,null,url,token)