2010-09-02 33 views

回答

2
 private static final String CERT_FILE_LOC = "/aaa/bbb/ccffdd.jks"; 
     System.setProperty("javax.net.ssl.trustStore", CERT_FILE_LOC); 


     HostnameVerifier hv = new HostnameVerifier() { 
      public boolean verify(String urlHostName, SSLSession session) { 
       System.out.println("Warning: URL Host: "+urlHostName+" vs. "+session.getPeerHost()); 

       return true; 
      } 
     }; 

     HttpsURLConnection.setDefaultHostnameVerifier(hv); 

     URL url = new URL(inputUrl); 
     HttpsURLConnection connection = (HttpsURLConnection)url.openConnection(); 

     connection.setDoOutput(true); 

     BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); 
     String line; 

     while ((line = in.readLine()) != null) { 
      responseXml=responseXml+line; 
      } 
     in.close(); 
     System.out.println("responseXml"); 
0

獲取Web服務的WSDL,並將其用於您的工具。 Eclipse Java EE中的Web Service Explorer是一個很好的開始。

0

獲取Web服務定義(WSDL ),並使用WSDL2Java的客戶端生成Java客戶端的WSDL。使用生成的客戶端代碼來調用Web服務。您選擇的Webservice框架將負責爲您構建和解析SOAP請求/響應。示例請參閱Apache Axis