博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
WSDL测试webservice接口记录
阅读量:5216 次
发布时间:2019-06-14

本文共 5304 字,大约阅读时间需要 17 分钟。

收到一个事情,需要对接第三方API,对方给了个service,看了一下,原来是webservices的。

上一次测试webervice的接口,还是至少八九年前的时候了,这种相对比较老旧的也好久不在使用。

于是,简单搞了一下,从搭环境到测试完成,基本花了10来分钟,对比结果花点时间,也抽空简单记录一下。 

请求:

http://www.shuce.com.cn/services/CommService?wsdl

接口:call

参数:

dscx_lz
74481885-4244-47d9-aa51-88e2aabebdbc
cxveh
C372DD
02

 

返回:

{"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"}

 

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:

115.239.210.27

response:

115.239.210.27
浙江省绍兴市 电信

...

如果你想要尝试一下,进行一些测试,,可以用来测试,可以试试。

 

所谓授之以鱼,不如授之以渔。这里也补上一些前提和方法:

下载地址:

官网:

文件地址:

下载地址:

下载之后的安装很简单,略过,简要提一下启动。如果用的是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配置信息中地址,在浏览器中出入:

  (2)使用soapUI测试接口:

  注意:在测试之前,要先开启接口项目

  ①在接口项目开启之后,打开工具soapUi,新建(file→create empty project),如下图所示:

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

  打开如下图的页面:

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

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

 

  ④在"?"号处输入相关的参数,点击运行,如果右侧空白没有出现错误的信息,说明接口方法可以使用

  测试失败,如下所示:(对于不同的项目,可能提示信息有所不同,要视情况而定,这里不是绝对的结果)

  测试成功,如下图:(对于不同的项目,可能提示信息有所不同,要视情况而定,这里不是绝对的结果)

 

可见,WSDL的测试相对比较简单,如果没接触过的话,花几分钟看下就会明白。

如上。

 

--20180912 15:49于沪 长宁白猫科技园

 

转载于:https://www.cnblogs.com/haochuang/p/9636315.html

你可能感兴趣的文章
lintcode-28-搜索二维矩阵
查看>>
【洛谷1501】[国家集训队] Tree II(LCT维护懒惰标记)
查看>>
764. Largest Plus Sign
查看>>
驱动-helloworld(第一天)
查看>>
loj#6281. 数列分块入门 5
查看>>
hdoj5893
查看>>
理解管理信息系统
查看>>
第三章:选择结构(一)
查看>>
缓存(Cache)学习笔记
查看>>
Vue2.0 的漫长学习ing-1-3
查看>>
mount命令(用来挂载硬盘或镜像等)
查看>>
Bash shell中的位置参数$#,$*,$@,$0,$1,$2...及特殊参数$?,$-等的含义
查看>>
Android实现获取系统应用列表(转)
查看>>
5.User Interface/Styles and Themes
查看>>
Scrapy爬虫小demo总结
查看>>
Python基础之---04数据类型
查看>>
Android面试题-兴奋了有木有
查看>>
C#字符串类的典型用法
查看>>
强者运强
查看>>
Spring 梳理 - 构造web项目时,使用eclipse如何引用jar包
查看>>