【问题标题】:How to call a webservice method for testing, e.g. from a browser如何调用 webservice 方法进行测试,例如从浏览器
【发布时间】:2013-07-29 12:41:06
【问题描述】:

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

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

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

【问题讨论】:

  • 我不明白这个问题。您想在不编写客户端应用程序的情况下调用 ws 中的方法吗?你不能通过使用浏览器甚至 curl 来做到这一点吗?
  • 您必须使用像 SOAP UI 或等效的应用程序。
  • 您必须描述更多有关如何构建 Web 服务的信息。例如,如果它是使用 DataSnap 和 HTTP 支持构建的,那么您可以使用 Web 浏览器调用任何方法。

标签: web-services delphi dll service


【解决方案1】:

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

以下是发布到free weather web service 的示例请求。

【讨论】:

    【解决方案2】:

    您的请求可能是这样的:

    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>
    

    【讨论】:

      猜你喜欢
      • 2011-05-25
      • 2013-07-10
      • 1970-01-01
      • 2012-08-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-08-15
      相关资源
      最近更新 更多