当前位置:网站首页>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
边栏推荐
- Use model load_ state_ Attributeerror appears when dict(): 'STR' object has no attribute 'copy‘
- C list field sorting contains numbers and characters
- C. Tree infection (simulation + greed)
- Sword finger offer: the median in the data stream (priority queue large top heap small top heap leetcode 295)
- [WinUI3]编写一个仿Explorer文件管理器
- Learning Android II from scratch - activity
- View, modify and delete [database] table
- Customize the navigation bar at the top of wechat applet (adaptive wechat capsule button, flex layout)
- Basic concepts of multithreading (concurrency and parallelism, threads and processes) and entry cases
- Knowledge points sorting: ES6
猜你喜欢
[WinUI3]編寫一個仿Explorer文件管理器
MySQL -- execution process and principle of a statement
Learning Android V from scratch - UI
深度学习笔记 —— 语义分割和数据集
DIY is an excel version of subnet calculator
MySQL - index
[winui3] Écrivez une copie du gestionnaire de fichiers Explorer
View analysis of scenic spots in ArcGIS
Painless upgrade of pixel series
Introduction to raspberry pie 3B - system installation
随机推荐
Raspberry pie + opencv + opencv -- face detection ------- environment construction
selenium模式下切换窗口,抓取数据的实现
Machine learning - linear regression
PHP 统计指定文件夹下文件的数量
静态流水线和动态流水线的区别认识
Sword finger offer: symmetric binary tree (recursive iteration leetcode 101)
Making message board with PHP + MySQL
MySQL slow query
Spell it! Two A-level universities and six B-level universities have abolished master's degree programs in software engineering!
Introduction to load balancing
The object needs to add additional attributes. There is no need to add attributes in the entity. The required information is returned
Pixel mobile phone brick rescue tutorial
js 判斷數字字符串中是否含有字符
Teach you how to build the ruoyi system by Tencent cloud
持续集成(CI)/持续交付(CD)如何彻底改变自动化测试
多线程基本概念(并发与并行、线程与进程)和入门案例
Docker installation and mysql5 7 installation
[winui3] write an imitation Explorer file manager
Jetpack -- lifecycle usage and source code analysis
Agile practice | agile indicators to improve group predictability