当前位置:网站首页>The WebService interface writes and publishes calls to the WebService interface (I)
The WebService interface writes and publishes calls to the WebService interface (I)
2022-04-23 05:01:00 【Chen junyang】
Write and publish webService Interface
1. To write webService Interface
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
@WebService(name = "Login",// Port name
serviceName = "testService", // WebService The service name
targetNamespace = "http://webService.test.com" // Namespace , The default is inverted package name
)
public interface TestService {
// Provide an open service
@WebMethod(operationName = "loginPass")
// Change the method name
String loginPass(@WebParam(name = "userId") String userId,@WebParam(name = "password") String password);
}
2. Write interface implementation classes
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
/** 1. Implementation class */
@WebService(endpointInterface = "com.thinkgem.jeesite.common.webService.MyService",// Interface path
name = "Login",// Port name
serviceName = "testService", // WebService The service name
targetNamespace = "http://webService.test.com" // Namespace , The default is inverted package name ( If code is generated when calling , be com.test.webService Package path for code )
)
public class TestServiceImpl implements TestService {
@WebMethod(operationName = "loginPass" // Change the method name
)
@Override
public String loginPass(
@WebParam(name = "userId") String userId,
@WebParam(name = "password") String password) {
if ("admin".equals(userId) && "123".equals(password)) {
return "success";
}
return "error";
}
}
3. Release webService Interface services
import javax.xml.ws.Endpoint;
public class TestPublisher {
public static void main(String[] args) {
// Designated Services url
String url = "http://localhost:8089/testservice";
// Specify the service implementation class
TestService server = new TestServiceImpl();
// Use the command line publisher Endpoint Publishing services
Endpoint.publish(url, server);
}
}
4. Look at the test webService Whether the interface service is published successfully
Set when the browser accesses the publication url + ?wsdl, Such as :http://localhost:8089/testservice?wsdl
If it shows :

5. webService Interface call
see webService The interface is written and published with webService Interface call ( Two )
版权声明
本文为[Chen junyang]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220552495027.html
边栏推荐
- Analysis of POM files
- Wechat payment function
- Machine learning - linear regression
- POI export message list (including pictures)
- Learning Android II from scratch - activity
- QPushButton slot function is triggered multiple times
- Day.js 常用方法
- js 判斷數字字符串中是否含有字符
- Unity C# 网络学习(四)
- This call when the transaction does not take effect
猜你喜欢
![[database] MySQL basic operation (basic operation ~)](/img/0c/a8d858fa74ffed2a266ca77c783c7f.png)
[database] MySQL basic operation (basic operation ~)
![Solve valueerror: argument must be a deny tensor: 0 - got shape [198602], but wanted [198602, 16]](/img/99/095063b72390adea6250f7b760d78c.png)
Solve valueerror: argument must be a deny tensor: 0 - got shape [198602], but wanted [198602, 16]

What are the redis data types

Deep learning notes - semantic segmentation and data sets
![[winui3] Écrivez une copie du gestionnaire de fichiers Explorer](/img/3e/62794f1939da7f36f7a4e9dbf0aa7a.png)
[winui3] Écrivez une copie du gestionnaire de fichiers Explorer

Sword finger offer: the median in the data stream (priority queue large top heap small top heap leetcode 295)
![[winui3] write an imitation Explorer file manager](/img/3e/62794f1939da7f36f7a4e9dbf0aa7a.png)
[winui3] write an imitation Explorer file manager

Excel protects worksheets and workbooks from damage

redis数据类型有哪些

JS engine loop mechanism: synchronous, asynchronous, event loop
随机推荐
敏捷实践 | 提高小组可预测性的敏捷指标
Getprop property
JS engine loop mechanism: synchronous, asynchronous, event loop
Introduction to load balancing
Deep learning notes - fine tuning
【数据库】MySQL单表查询
C list field sorting contains numbers and characters
Innovation training (V) mid term inspection
C# List字段排序含有数字和字符
和谐宿舍(线性dp / 区间dp)
L2-011 play binary tree (build tree + BFS)
List< Map> Replication: light copy and deep copy
selenium模式下切换窗口,抓取数据的实现
Independent station operation | Facebook marketing artifact - chat robot manychat
JS generates a specified number of characters according to some words
Machine learning - linear regression
Set Chrome browser background to eye protection (eye escort / darkreader plug-in)
AQS源码阅读
Mac enters MySQL terminal command
#define 定义常量和宏,指针和结构体