1. 先使用 apache 的 axis 依據 WSDL 檔來產生 client 端所需的 java 檔。
java org.apache.axis.wsdl.WSDL2Java CBService.wsdl
2. 然後建立一個新的 java 類別來使用步驟 1 所產生的 class。
CBService service = new CBServiceLocator();
// Now use the service to get a stub which implements the SDI. XMLServiceSoapPort
port = service.getXMLServiceSoapPort();
String SendXML = "1234";
System.out.println(port.XServiceMethod(SendXML));
3. 若欲連結的 Web Service 是架在 https 上時,
必須先將該 ssl 網站的憑證匯出
http://jugsi.etruriainnovazione.it/Wiki.jsp?page=WebServiceOverHTTPS然後將憑證匯入 keystore 中
keytool -importcert -alias SecuCA -file server.cer
最後於程式最前方加上
System.setProperty("javax.net.ssl.trustStore", "myabsolutepathkeystore");
System.setProperty("javax.net.ssl.trustStorePassword", "mypassword") ;