【WebService】使用postman调用WebService方法

1、需求

公司原来有一个项目使用的是WebService,想模拟一下怎么调用WebService的方法,使用postman调用怎么调用。

2、postman方式

接口:http://127.0.0.1:8080/SecurityWebService/SecurityCommand?wsdl

对应你的代码配置:

java 复制代码
@Configuration
public class WebConfig {

    @Resource
    private BlocCommandReceiveService blocCommandReceiveService;

    @Bean
    public ServletRegistrationBean disServlet() {
        // WebService访问的父路径,可以找到所有wsdl文件
        return new ServletRegistrationBean(
                new CXFServlet(), "/SecurityWebService/*");
    }

    @Bean(name = Bus.DEFAULT_BUS_ID)
    public SpringBus springBus() {
        return new SpringBus();
    }

    @Bean
    public Endpoint endpoint() {
        EndpointImpl endpoint = new EndpointImpl(springBus(), this.blocCommandReceiveService);
        endpoint.publish("/SecurityCommand");
        return endpoint;
    }

}

注意:Content-Type:text/xml;charset=UTF-8 默认的要注释

接下来解析一下请求xml

xml 复制代码
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:test="http://service.cmcc.databus.idss.com/">
    <soap:Body>
        <test:security_command >
            <odId><![CDATA[123213213]]></odId>
            <randVal><![CDATA[123213213]]></randVal>
            <timeStamp><![CDATA[123213213]]></timeStamp>
            <pwdHash><![CDATA[123213213]]></pwdHash>
            <command><![CDATA[123213213]]></command>
            <commandHash><![CDATA[123213213]]></commandHash>
            <commandType><![CDATA[123213213]]></commandType>
            <commandSequence><![CDATA[123213213]]></commandSequence>
            <encryptAlgorithm><![CDATA[123213213]]></encryptAlgorithm>
            <hashAlgorithm><![CDATA[123213213]]></hashAlgorithm>
            <compressionFormat><![CDATA[123213213]]></compressionFormat>
            <commandVersion><![CDATA[123213213]]></commandVersion>
        </test:security_command>
    </soap:Body>
</soap:Envelope>

xmlns:test: 不能少,必须是这个,参数为代码配置的targetNamespace 。

xml 复制代码
targetNamespace = "http://service.cmcc.databus.idss.com/"

<test:security_command >: test不变,后面的是方法名称,你代码配置的:如果没有配置就默认方法名称。

xml 复制代码
@WebMethod(operationName = "security_command")

中间的就是参数了,值必须要包住。<![CDATA[123213213]]>。

之后就可以请求了。

相关推荐
我的xiaodoujiao6 小时前
使用 Python 语言 从 0 到 1 搭建完整 Web UI自动化测试学习系列 40--完善优化 Allure 测试报告显示内容
python·学习·测试工具·pytest
我的xiaodoujiao7 小时前
使用 Python 语言 从 0 到 1 搭建完整 Web UI自动化测试学习系列 41--自定义定制化展示 Allure 测试报告内容
python·学习·测试工具·pytest
玩转数据库管理工具FOR DBLENS9 小时前
人工智能:演进脉络、核心原理与未来之路 审核中
数据库·人工智能·测试工具·数据库开发·数据库架构
小罗和阿泽11 小时前
论坛系统测试报告
功能测试·测试工具·压力测试·可用性测试
可可南木1 天前
3070文件格式--6--board文件格式详解 6
功能测试·测试工具·pcb工艺
爱学习的潇潇1 天前
Postman学习之常用断言
自动化测试·软件测试·功能测试·学习·程序人生·lua·postman
程序员雷叔1 天前
在postman设置请求里带动态token,看看这两种方法!
selenium·测试工具·单元测试·测试用例·pytest·lua·postman
Hacker_xingchen1 天前
如何用Postman做接口自动化测试及完美的可视化报告?
自动化测试·软件测试·测试工具·职场和发展·postman
AI软件工程实践1 天前
软件工程里 Postman 的文件上传与下载测试技巧
测试工具·ai·lua·postman
恃宠而骄的佩奇1 天前
APP客户端安全评估思路及工具分享
测试工具·安全·网络安全·app客户端安全评估