2010-09-02 54 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