WSDL测试webservice接口记录
收到一个事情,需要对接第三方API,对方给了个service,看了一下,原来是webservices的。
上一次测试webervice的接口,还是至少八九年前的时候了,这种相对比较老旧的也好久不在使用。
于是,简单搞了一下,从搭环境到测试完成,基本花了10来分钟,对比结果花点时间,也抽空简单记录一下。
请求:
http://www.shuce.com.cn/services/CommService?wsdl
接口:call
参数:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://service.shuce.com.cn">
<soapenv:Header/>
<soapenv:Body>
<ser:call>
<ser:act>dscx_lz</ser:act>
<!--1 or more repetitions:-->
<ser:args>74481885-4244-47d9-aa51-88e2aabebdbc</ser:args>
<ser:args>cxveh</ser:args>
<ser:args>C372DD</ser:args>
<ser:args>02</ser:args>
</ser:call>
</soapenv:Body>
</soapenv:Envelope>
返回:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<callResponse xmlns="http://service.shuce.com.cn">
<callReturn>{"ret":1,"clpp":"宝马牌","clxh":"BMW7202ES(BMWX1)","gcjk":"国产","zzg":"中国","zzcmc":"华晨宝马汽车有限公司","fdjxh":"N46B20E","hdzk":"5","ckg":"4477*1798*1577","csys":"棕","rlzl":"汽油","pl":"1995","gl":"122","cllx":"小型轿车","syxz":"非营运","ccdjrq":"20130917","zt":"正常","hbdbqk":"GB18352.3-2005(国Ⅳ阶段)","ccrq":"20130522","yxqz":"20190930","qzbfqz":"20991231"}
</callReturn>
</callResponse>
</soapenv:Body>
</soapenv:Envelope>
json格式化结果:
{
"ret": 1,
"clpp": "宝马牌",
"clxh": "BMW7202ES(BMWX1)",
"gcjk": "国产",
"zzg": "中国",
"zzcmc": "华晨宝马汽车有限公司",
"fdjxh": "N46B20E",
"hdzk": "5",
"ckg": "4477*1798*1577",
"csys": "棕",
"rlzl": "汽油",
"pl": "1995",
"gl": "122",
"cllx": "小型轿车",
"syxz": "非营运",
"ccdjrq": "20130917",
"zt": "正常",
"hbdbqk": "GB18352.3-2005(国Ⅳ阶段)",
"ccrq": "20130522",
"yxqz": "20190930",
"qzbfqz": "20991231"
}

其他
后来,我看了一下别的wsdl:
http://www.webxml.com.cn/WebServices/IpAddressSearchWebService.asmx?wsdl
做了一个测试,结果测试OK,简要也记录一下
request:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://WebXml.com.cn/">
<soapenv:Header/>
<soapenv:Body>
<web:getCountryCityByIp>
<!--Optional:-->
<web:theIpAddress>115.239.210.27</web:theIpAddress>
</web:getCountryCityByIp>
</soapenv:Body>
</soapenv:Envelope>
response:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<getCountryCityByIpResponse xmlns="http://WebXml.com.cn/">
<getCountryCityByIpResult>
<string>115.239.210.27</string>
<string>浙江省绍兴市 电信</string>
</getCountryCityByIpResult>
</getCountryCityByIpResponse>
</soap:Body>
</soap:Envelope>
...
如果你想要尝试一下,进行一些测试,这里提供了一些wsdl,可以用来测试,可以试试。
所谓授之以鱼,不如授之以渔。这里也补上一些前提和方法:
下载地址:
官网:https://www.soapui.org/professional/soapui-pro.html
文件地址:http://cncspace.onlinedown.net/down/SoapUI-5.2.1-mac-bin.zip
下载地址:http://www.onlinedown.net/soft/177299.htm
下载之后的安装很简单,略过,简要提一下启动。如果用的是mac的话,这样启动:
启动命令:
cd /Users/hao/Downloads/SoapUI-5.2.1-mac-bin/SoapUI-5.2.1/bin
./soapui.sh
haodeMBP:bin hao$ pwd
/Users/hao/Downloads/SoapUI-5.2.1-mac-bin/SoapUI-5.2.1/bin
haodeMBP:bin hao$ ls
SoapUI-Spashscreen.png installationcomplete.sh mockservicerunner.sh soapui-errors.log soapui.sh toolrunner.sh wargenerator.sh
actions listeners securitytestrunner.sh soapui-log4j.xml starter-page.html uninstallactiontrack.sh
ext loadtestrunner.sh soapui-5.2.1.jar soapui.log testrunner.sh updateinstallation.sh
haodeMBP:bin hao$ ./soapui.sh
================================
=
= SOAPUI_HOME = /Users/hao/Downloads/SoapUI-5.2.1-mac-bin/SoapUI-5.2.1
=
================================
Configuring log4j from [/Users/hao/Downloads/SoapUI-5.2.1-mac-bin/SoapUI-5.2.1/bin/soapui-log4j.xml]
16:26:15,406 INFO [DefaultSoapUICore] Creating new settings at [/Users/hao/soapui-settings.xml]
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
16:26:16,523 INFO [PluginManager] 0 plugins loaded in 3 ms
16:26:16,523 INFO [DefaultSoapUICore] All plugins loaded
Configuring log4j from [/Users/hao/Downloads/SoapUI-5.2.1-mac-bin/SoapUI-5.2.1/bin/soapui-log4j.xml]
16:26:16,729 INFO [DefaultSoapUICore] Creating new settings at [/Users/hao/soapui-settings.xml]
16:26:16,740 INFO [PluginManager] 0 plugins loaded in 0 ms
16:26:16,740 INFO [DefaultSoapUICore] All plugins loaded
16:26:23,688 INFO [DefaultSoapUICore] Defaulting to native L&F for Mac OS X
16:26:23,740 INFO [SoapUI] Used java version: 1.8.0_181
16:28:17,764 INFO [SchemaUtils] Added default schema from file:/Users/hao/Downloads/SoapUI-5.2.1-mac-bin/SoapUI-5.2.1/bin/soapui-5.2.1.jar!/com/eviware/soapui/resources/xsds/xop.xsd with targetNamespace http://www.w3.org/2004/08/xop/include
16:28:17,781 INFO [SchemaUtils] Added default schema from file:/Users/hao/Downloads/SoapUI-5.2.1-mac-bin/SoapUI-5.2.1/bin/soapui-5.2.1.jar!/com/eviware/soapui/resources/xsds/XMLSchema.xsd with targetNamespace http://www.w3.org/2001/XMLSchema
16:28:17,782 INFO [SchemaUtils] Added default schema from file:/Users/hao/Downloads/SoapUI-5.2.1-mac-bin/SoapUI-5.2.1/bin/soapui-5.2.1.jar!/com/eviware/soapui/resources/xsds/xml.xsd with targetNamespace http://www.w3.org/XML/1998/namespace
16:28:17,782 INFO [SchemaUtils] Added default schema from file:/Users/hao/Downloads/SoapUI-5.2.1-mac-bin/SoapUI-5.2.1/bin/soapui-5.2.1.jar!/com/eviware/soapui/resources/xsds/swaref.xsd with targetNamespace http://ws-i.org/profiles/basic/1.1/xsd
16:28:17,783 INFO [SchemaUtils] Added default schema from file:/Users/hao/Downloads/SoapUI-5.2.1-mac-bin/SoapUI-5.2.1/bin/soapui-5.2.1.jar!/com/eviware/soapui/resources/xsds/xmime200505.xsd with targetNamespace http://www.w3.org/2005/05/xmlmime
可见启动之后,就打开了对应的应用程序窗口。
至于工具的使用,我向来觉得是不用看教程,任何工具拿上来随便点两下,就明白了,这个soapUI也是一样的。
其实方法这里已经写的很清楚了,而且没什么问题。照着操作即可。
以上是原创,下面这一段是摘录的。
测试操作步骤如下:
(1)首先找到cxf-webservice.xml配置信息中地址,在浏览器中出入:http://127.0.0.1:8080/ssg?wsdl会生成文档说明,直接给要对接的用户即可
<jaxws:endpoint id="ssg" implementor="cn.exchange.cxf.DataExchangeWebServiceImpl"
address="http://127.0.0.1:8080/ssg">
</jaxws:endpoint>
(2)使用soapUI测试接口:
注意:在测试之前,要先开启接口项目
①在接口项目开启之后,打开工具soapUi,新建(file→create empty project),如下图所示:

②右击工程project——add wsdl,如下图所示:

打开如下图的页面:

③然后进入如下页面:(修改:应该双击"request1")

双击"request1"出现如下的窗口:

④在"?"号处输入相关的参数,点击运行,如果右侧空白没有出现错误的信息,说明接口方法可以使用
测试失败,如下所示:(对于不同的项目,可能提示信息有所不同,要视情况而定,这里不是绝对的结果)

测试成功,如下图:(对于不同的项目,可能提示信息有所不同,要视情况而定,这里不是绝对的结果)
可见,WSDL的测试相对比较简单,如果没接触过的话,花几分钟看下就会明白。
如上。
--20180912 15:49于沪 长宁白猫科技园
WSDL测试webservice接口记录的更多相关文章
- Python之测试webservice接口
前段时间学习了Python操作http接口,觉得挺容易的.最近项目组也有接触webservice接口,心里想想是否Python也可以操作这类接口.于是利用伟大的度娘,花了6个小时研究出来了,所以迫不及 ...
- 【SoapUI、Postman、WebServiceStudio、Jmeter】接口测试工具结合测试webservice接口(发送XML格式参数)
目录: SoapUI测试webservice接口,发送XML格式参数 Postman测试webservice接口,发送XML格式参数 WebServiceStudio.exe测试webservice接 ...
- 『动善时』JMeter基础 — 50、使用JMeter测试WebService接口
目录 1.什么是WebService 2.WebService和SOAP的关系 3.什么是WSDL 4.测试WebService接口前的准备 (1)如何判断是WebService接口 (2)如何获取W ...
- 『动善时』JMeter基础 — 51、使用JMeter测试WebService接口
目录 1.什么是WebService 2.WebService和SOAP的关系 3.什么是WSDL 4.测试WebService接口前的准备 (1)如何判断是WebService接口 (2)如何获取W ...
- 关于python测试webservice接口的视频分享
现在大公司非常流行用python做产品的测试框架,还有对于一些快速原型产品的开发也好,很好地支持OO编程,代码易读.Python的更新挺快的,尤其是第三方库. 对于测试人员,代码基础薄弱,用pytho ...
- 使用PostMan测试WebService接口
使用PostMan测试WebService接口 参考资料: 通过XML请求WebServer https://blog.csdn.net/qq_33933408/article/details/53 ...
- python实现建立soap通信(调用及测试webservice接口)
实现代码如下: #调用及测试webservice接口 import requests class SoapConnect: def get_soap(self,url,data): r = reque ...
- jmeter测试webservice接口
webservice怎样使用jmeter测试呢? 测试样例url=http://www.webxml.com.cn/WebServices/IpAddressSearchWebService.asmx ...
- java 调用wsdl的webservice接口 两种调用方式
关于wsdl接口对于我来说是比较头疼的 基本没搞过.一脸懵 就在网上搜 看着写的都很好到我这就不好使了,非常蓝瘦.谨以此随笔纪念我这半个月踩过的坑... 背景:短短两周除了普通开发外我就接到了两个we ...
随机推荐
- 038 lock wait timeout exceeded;try restarting transaction
场景:有两个会话,其中会话1在事务操作,会话2在等待这个事务操作完成,然后会有这个报错产生. 通过查询资料,在这里整理一下. 一:总结timeout参数的作用 1.操作 2.具体解释 1)connec ...
- <%= %>、<% %>、<%@ %>和<%# %>的区别
轉至http://blog.csdn.net/wildfeng04/article/details/7290126 <%=%> 里面放的变量名 <% %> 中间一般放函数或者方 ...
- webstorm 2017 激活破解方法大全
webstorm 作为最近最火的前端开发工具,也确实对得起那个价格,但是秉着勤俭节约的传统美德,我们肯定是能省则省啊. 方法一:(更新时间:2018/4/8)v3.3 注册时,在打开的License ...
- shell常用的系统变量
$#: 命令行参数的个数 $n : 当前程序的第n个参数,n=1,2,-,9 $0: 当前程序的名称 $?: 执行上一个指令或函数的返回值 $*: 以"参数1,参数 ...
- python 数据结构之归并排序
def merger_sort(alist): if len(alist) <= 1 : return alist num=int(len(alist)/2) left=merger_sort( ...
- Linux下 nfs部署
一. 挂载一个硬盘来分享 二. 更改配置文件 三. 在配置文件中设置属性 四. 另一台机器 配置的虚拟机,将nfs关闭 配置文件也删除内容 挂载 挂载到部署nfs的极其 之 ...
- 2019-1-23IntelliJ IDEAget的使用教程及出现的问题
第一条:快捷键: Ctrl+Alt+h:显示调用当前方法的所有位置. Ctrl+Alt+B:跳转到方法实现处 自动修正,我这是 Alt + L Ctrl+Enter,导入包,自动修正Ctrl+Alt+ ...
- Codeforces.662C.Binary Table(状压 FWT)
题目链接 \(Description\) 给定一个\(n\times m\)的\(01\)矩阵,你可以选择一些行和一些列并将其中所有的\(01\)反转.求操作后最少剩下多少个\(1\). \(n\le ...
- Kotlin基础(二)函数的定义与调用
函数的定义与调用 一.预备知识:在Kotlin中创建集合 fun main(args: Array<String>) { //Kotlin中定义各自集合 val ,,,) val list ...
- 你真的了解META-INF吗?
你真的了解META-INF吗? 做过JAVA EE开发的工程师应该都知道在JAVA build出来的JAR或者WAR的顶层目录下有个META-INF文件夹吧,可是有多少人能够清楚说出这个文件夹到底是做 ...