当前位置:网站首页>The WebService interface writes and publishes calls to the WebService interface (2)
The WebService interface writes and publishes calls to the WebService interface (2)
2022-04-23 05:01:00 【Chen junyang】
webService Two methods of calling interface
1. According to the interface url Generate client code , Then call the interface service according to the generated code
(1) Use eclipse In the project directory where the interface needs to be called src Right click , choice new, Pictured :
(2) Click on next entry webService Interface url Address http://localhost:8089/testservice?wsdl. Pictured :
(3) Click on Finish Button , Automatically generate client code , Check the code according to the package path set by the client , Pictured :
(4) Create a call interface example ,TestServiceClient class :
public static void main(String[] args) {
LoginProxy proxy = new LoginProxy();
try {
System.out.println("====="+proxy.loginPass("admin", "123"));
} catch (RemoteException e) {
e.printStackTrace();
}
}
2. With the native jdk Call interface service example :
public static void main(String[] args) throws Exception {
URL url = new URL("http://localhost:8089/testservice");
// Specify namespace and service name
QName qName = new QName("http://webService.test.com", "testService");
Service service = Service.create(url, qName);
// adopt getPort Method returns the specified interface
TestService myServer = service.getPort(new QName("http://webService.test.com",
"LoginPort"), TestService.class);
// Calling method Get the return value
String result = myServer.loginPass("admin", "123");
System.out.println(result);
}
notes : call webService Interface , It may take a few jar package , Such as :axis.jar、axis-ant.jar、axis-schema.jar、commons-discovery-0.2.jar、commons-logging-1.0.4.jar、jaxrpc.jar、wsdl4-1.5.1.jar
版权声明
本文为[Chen junyang]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220552495068.html
边栏推荐
- 静态流水线和动态流水线的区别认识
- Independent station operation | Facebook marketing artifact - chat robot manychat
- Innovation training (V) configuration information
- 退出vim的方法
- Innovation training (VII) FBV view & CBV view
- 敏捷实践 | 提高小组可预测性的敏捷指标
- Special topic of data intensive application system design
- redis和mysql区别
- 使用model.load_state_dict()时,出现AttributeError: ‘str‘ object has no attribute ‘copy‘
- 直播带货表格模板-自动显示图片-自动关联系列商品
猜你喜欢
AQS源码阅读
Excel protects worksheets and workbooks from damage
MySQL -- execution process and principle of a statement
Customize the navigation bar at the top of wechat applet (adaptive wechat capsule button, flex layout)
What are the redis data types
PHP+MySQL 制作留言板
Deep learning notes - data expansion
COM in wine (2) -- basic code analysis
多线程基本概念(并发与并行、线程与进程)和入门案例
Details related to fingerprint payment
随机推荐
Innovation training (10)
QPushButton slot function is triggered multiple times
Innovation training (IX) integration
Detailed explanation of hregionserver
Analysis of POM files
Implementation of switching windows and capturing data in selenium mode
js 判斷數字字符串中是否含有字符
[2022 ICLR] Pyramid: low complexity pyramid attention for long range spatiotemporal sequence modeling and prediction
Innovation training (XI) airline ticket crawling company information
Graduation project
COM in wine (2) -- basic code analysis
Innovation training (IV) preliminary preparation - server
Day.js 常用方法
Repair of self calibration SPC failure of Tektronix oscilloscope dpo3054
直播带货表格模板-自动显示图片-自动关联系列商品
Progress of innovation training (IV)
MySQL time function query
L2-011 玩转二叉树(建树+BFS)
Mac enters MySQL terminal command
深度学习笔记 —— 语义分割和数据集