预备知识:
http://www.cnblogs.com/yongfeng/archive/2013/01/30/2883146.html?utm_source=tuicool&utm_medium=referral
web service:在线应用服务,其他应用程序能通过网络协议和规定的数据格式(http、XML、soap)来访问。主要目的是跨平台的可互操作性。Web service可以理解为是一个应用程序,它向外界暴露出一个能够通过Web进行调用的API
XML:(Extensible Markup Language)扩展型可标记语言。描述数据的基本方式,是Soap的基础。
Soap:(Simple Object Access Protocol)简单对象存取协议。表示信息交换的协议,是XML Web Service 的通信协议。是一种轻量的、简单的、基于 XML 的协议,它被设计成在 WEB 上交换结构化的和固化的信息
WSDL:(Web Services Description Language) Web服务描述语言
UDDI (Universal Description, Discovery, and Integration) 通用描述、发现与集成,是一种独立于平台的、基于XML语言用于在互联网上描述商务的协议。
目的:
在http://www.webservicex.net/geoipservice.asmx?op=GetGeoIP页面输入IP地址获取改ip所属国家。
To start with an example, I was trying to test getgeoIPservicefrom below WSDL.
http://www.webservicex.net/geoipservice.asmx?wsdl
原q&a引用http://jmeter.512774.n5.nabble.com/Query-how-to-Test-web-services-in-Jmeter-2-10-td5718728.html
现在网上多以webservice(SOAP) Request来实现,但在实操时发现这个SAMPLE 添加不成功。其实可通过别的途径实现notice:Webservice (SOAP) Request has been removed by default from GUI as Element is deprecated. (Use HTTP Request with Body Data, see also the Template Building a SOAP Webservice Test Plan), if you need to show it, see property not_in_menu in jmeter.properties
There are two ways to test web services (SOAP requests): with HTTP Request and SOAP/XML-RPC Request
In this case:
1. HTTP request
In HTTP Request Sampler fill:
Server name: www.webservicex.net
Path: /geoipservice.asmx
Method: POST
Body data:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetGeoIP xmlns="http://www.webservicex.net/">
<IPAddress>10.1.1.1</IPAddress>
</GetGeoIP>
</soap:Body>
</soap:Envelope>
Add HTTP Header Manager,
Content-Type: text/xml
2. SOAP/XML-RPC Request
Fill SOAP/XML-RPC Request sampler:
URL: http://www.webservicex.net/geoipservice.asmx?wsdl
Send SOAPAction: http://www.webservicex.net/GetGeoIP
Soap/XML-RPC Data:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetGeoIP xmlns="http://www.webservicex.net/">
<IPAddress>10.1.1.1</IPAddress>
</GetGeoIP>
</soap:Body>
</soap:Envelope>
方法一:http request
参考:http://jmeter.apache.org/usermanual/build-ws-test-plan.html
1、按模板创建Building a SOAP Webservice Test Plan
2、更改参数
方法二:SOAP/XML-RPC Request