繁体   English   中英

如何调用网络服务方法进行测试,例如从浏览器

[英]How to call a webservice method for testing, e.g. from a browser

有一个 dll 网络服务(用 Delphi 制作),它有一个名为List的方法,它返回一个字符串列表(宽字符串)。

是否有任何方法可以调用该服务而无需编写客户端应用程序来使用它?

例如: http : //misitio.com : 8080/ miwebservice.dll?methodname= list

Chrome App Postman可以发送 SOAP 请求。 您只需要提供 Web 服务 URL,选择 POST,设置正确的内容类型标头(text/xml、application/soap+xml 等),并在请求中提供正确的 xml soap 正文。 单击发送。

下面是一个发布到免费天气网络服务的示例请求。

在此处输入图片说明

您的请求可能类似于:

POST /WeatherWS/Weather.asmx/GetCityWeatherByZIP HTTP/1.1
Host: wsf.cdyne.com
Cache-Control: no-cache
Postman-Token: e5bc46a4-71ac-f357-78a7-c4b4de894afb
Content-Type: application/x-www-form-urlencoded

ZIP=90210

响应将是:

<?xml version="1.0" encoding="utf-8"?>
<WeatherReturn xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://ws.cdyne.com/WeatherWS/">
  <Success>true</Success>
  <ResponseText>City Found</ResponseText>
  <State>CA</State>
  <City>Beverly Hills</City>
  <WeatherStationCity>Van Nuys</WeatherStationCity>
  <WeatherID>4</WeatherID>
  <Description>Sunny</Description>
  <Temperature>68</Temperature>
  <RelativeHumidity>54</RelativeHumidity>
  <Wind>CALM</Wind>
  <Pressure>29.89R</Pressure>
  <Visibility />
  <WindChill />
  <Remarks />
</WeatherReturn>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM