IDEA中如何生成客戶端代碼
1、添加webservices客戶端支持
在對應(yīng)模塊上右鍵,選擇添加,選擇webservices客戶端
選擇生成方式為 Apache Axis。
首次配置需要下載Axis相關(guān)jar包,選擇【下載】。
后續(xù)在使用直接選擇【使用庫】。
確定后會彈出一個對話框,可以選擇取消
2、客戶端代碼生成
在對應(yīng)的src上或要要生成客戶端代碼的包名上右鍵,選擇創(chuàng)建web服務(wù)客戶端。
填入wsdl地址文章來源:http://www.zghlxwxcb.cn/news/detail-530347.html
3、客戶端方法調(diào)用的示例代碼
調(diào)用webservice服務(wù)端方法,修改用戶密碼文章來源地址http://www.zghlxwxcb.cn/news/detail-530347.html
public class TestClient {
public static void main(String[] args) throws MalformedURLException, ServiceException, RemoteException {
HrmServiceLocator hrmServiceLocator = new HrmServiceLocator();
HrmServicePortType portType = hrmServiceLocator.getHrmServiceHttpPort(new URL("http://192.168.231.137:8088/services/HrmService?wsdl"));
portType.changeUserPassword("127.0.0.1","workcode","pwd");
}
}
到了這里,關(guān)于IDEA中如何生成webservice客戶端代碼的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!