How to call a webservice method for testing, e.g.

2019-02-21 21:40发布

问题:

There is a dll webservice (made with Delphi) that has a method called List which returns a list of strings (widestring).

Is there any method for calling that service without having to write a client application for consuming it?.

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

回答1:

The Chrome App Postman can send SOAP requests. You just need to provide the Web Service URL, select POST, set the proper content-type header (text/xml, application/soap+xml, etc.), and provide the proper xml soap body in the request. Click Send.

Below is an example request which posts to a free weather web service.



回答2:

Your request could be something like:

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

And the response will be:

<?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>