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

之后就可以请求了。

相关推荐
奔跑中的小象16 小时前
GuideLLM 压测实战指南:给大模型推理服务做一次完整 SLA 评估
测试工具·guidellm
Madison-No718 小时前
基于JMeter工具的性能测试(接口)
python·jmeter·postman
cpolar技术支持19 小时前
本地 Playwright 测试报告怎么远程复盘?Trace Viewer 跑起来后,用 cpolar 分享失败现场
前端·自动化测试·测试工具·cpolar·playwright
测试狗科研平台2 天前
材料热传导能力表征——热导率计算方法与流程解析
科技·测试工具·材料工程
Luminbox紫创测控2 天前
GB/T 34515—2026新规航天热平衡试验:太阳模拟器该怎么选
测试工具·安全性测试·测试标准·航天器热平衡
蒸鱼Yuzheng2 天前
Unity 与 Unreal 测试工具怎么回答:Profiler、日志、自动化与证据链
测试工具·unity·性能分析·游戏测试·unrealengine
匠测AI说3 天前
XCUITest 自动化全解:同进程白盒、XCTest 架构、自动同步机制与 iOS 端选型指南
测试工具·ios·自动化
xfilm埃利测量3 天前
四探针法测电阻:原理讲透 + 常见问题一次说清
测试工具·平面·四探针·薄膜电阻测量
Joyce_xiaobaibai4 天前
windows+Postman Newman+接口巡检
postman