【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]]>。

之后就可以请求了。

相关推荐
JTnnnnn9 小时前
【疑難排解】解決 Postman 無法上傳本地文件(Couldn‘t upload file)的問題
测试工具·postman
Minecraft红客10 小时前
ai_dialogue_framework项目1.0(纯原创)
c++·测试工具·电脑
就叫飞六吧18 小时前
wrk:现代 HTTP 性能测试工具(类cc)
网络协议·测试工具·http
代码游侠18 小时前
复习——网络测试工具
linux·开发语言·网络·笔记·学习·测试工具
我的xiaodoujiao18 小时前
使用 Python 语言 从 0 到 1 搭建完整 Web UI自动化测试学习系列 37--测试报告 Allure 前置步骤-配置安装 JDK 详细图文教程
java·开发语言·学习·测试工具
我的xiaodoujiao19 小时前
使用 Python 语言 从 0 到 1 搭建完整 Web UI自动化测试学习系列 36--二次封装MySQL数据库连接操作
python·学习·测试工具·pytest
曲莫终19 小时前
增强版JSON对比工具类
java·后端·测试工具·json
测试人社区-千羽2 天前
智能化测试:AI驱动的测试覆盖率提升方法论与实战路径
运维·人工智能·测试工具·程序人生·自动化·测试覆盖率
Wpa.wk2 天前
接口测试-Postman接口测试小练习-初级
经验分享·测试工具·接口测试·postman
潘达斯奈基~2 天前
spark性能优化6:内存管理
大数据·测试工具·性能优化·spark