SoapUI 如何 用 cxf 生成 webservice 代码
今天给大家讲解一下如何使用 SoapUI 使用 cxf 生成 webservice 代码。
添加接口
首先打开 SoapUI,并添加接口,选择选项卡中的 New Soap Project
,创建 Soap 接口。

选择 Add WSDL
这个选项,为了新建一个 webserivice 接口。

填入 wsdl
即可。

添加参数 发送
添加地址、请求参数,并测试一下此接口的连通性,看能不能连得上。

下载 cxf
接着就到了 生成 这一步了,使用生成的时候需要先去下载 cxf。

然后需要配置一下 cxf stubs:
- 填写 URL,可以是访问路径,也可以是文件路径
- 记得最下面的一定要打钩


一切准备好了,就点击 Generate,你会看到以下的提示,说明生成成功了~

找到文件
接着找到生成的文件,然后放到后端去,引入即可。

SoapUI 使用门槛有点高
用了下来,发现 SoapUI 使用门槛有点高
- 不支持中文
- 创建步骤太多
介绍一个超级方便使用的 API 工具 —— Apifox,真的非常好用!
Apifox 调试 webservice
webservice 接口创建
我们先创建一个 webservice 接口,创建非常方便,Apifox 提供了可视化的接口编辑表单,方便开发进行接口局创建。

这里注意,我们需要设置返回数据为 xml 格式。

填写 xml 请求参数
到了运行页,我们可以填写请求参数:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://service.webservicedemo.owater.com/">
<soapenv:Body>
<ws:getName>
<userId>Owater</userId>
</ws:getName>
</soapenv:Body>
</soapenv:Envelope>

调试 webservice
最后只需要点击 运行 即可发送,获得 xml 响应,并进行后续调试。

Apifox 超级好用的 API 工具
Apifox 免费、支持中文、支持自动化测试、支持 Mock、支持在线文档
- 集成了API 文档、API 调试、API Mock、API 自动化测试 API 一体化协作平台
- 拥有更先进的 API 设计/开发/测试工具
- Apifox = Postman + Swagger + Mock + JMeter
对于 前端、后端、测试 来说都太友好了,简直是开发团队 API 工具的不二之选啊!
