webservice
cxf 实现 webservice
问题
如何提供服务、客户端如何调用?
见参考资料
wsdl 怎么看?
postman 怎么调用?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| http://localhost:8023/api/services/ws/fmzh?wsdl 方法:post header:Content-Type=text/xml 参数:body - raw - xml <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:pm="http://server.webservice.iot.dataplatform.nti56.com"> <soap:Body> <pm:fmzhMethod2> <arg0 test="123"> <id>fmzh</id> <eleClassA>fmzhName</eleClassA> <birthday>2021-01-28T09:19:28.810+08:00</birthday> <remark>你好</remark> </arg0> </pm:fmzhMethod2> </soap:Body> </soap:Envelope>
|
- 入参出参如何设置对象类型?
定义 dto 对象即可
- xml 复杂标签如何设置
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| package com.nti56.dataplatform.iot.webservice.dto;
import lombok.Getter; import lombok.Setter;
import javax.xml.bind.annotation.*; import java.util.Date;
@Getter @Setter @XmlRootElement(name = "fields") @XmlAccessorType(XmlAccessType.FIELD) public class Request { private String id; @XmlElement(name="eleClassA") private String name; @XmlAttribute(name = "test") private Integer age; private Date birthday; private String remark; }
|
示例代码
springboot.example.apiversion
参考资料
基础入门
使用 postman 测试 webservice 接口 1
使用 postman 测试 webservice 接口 2