1

我将 asmx Web 服务用于 android 客户端应用程序。对于下面编写的示例 SOAP 1.1 请求,我需要 soap_action、method_name、命名空间和 url。如何为任何 Web 服务请求提供这些参数?我想了解这些参数的来源。(例如:method_name="GetKullaniciBilgileri" 它来自 body 标签之后)

POST /WebSite1/WebService.asmx HTTP/1.1
Host: localhost
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://kodmerkezi.net/HelloThere"

<?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>
    <HelloThere xmlns="http://kodmerkezi.net">
      <name>string</name>
    </HelloThere>
  </soap:Body>
</soap:Envelope>

我将这些服务运行为

http://localhost:56053/WebSite1/WebService.asmx?op=HelloThere
4

1 回答 1

1

命名空间="http://kodmerkezi.net"

SOAP_方法="HelloThere"

SOAP_Action ="http://kodmerkezi.net/HelloThere"

网址="http://localhost:56053/WebSite1/WebService.asmx"

如果您有 WSDL,实际上很容易提取这些字段。

WSDL 中已经提到了 SOAPAction,因此您可以从那里使用它。

SOAPAction = 命名空间 + 方法名

因此,形成 SOAPAction,使用第一部分(带有 http://... 的部分)作为名称空间,第二部分作为 SOAPMethod。

此外, MethodName 出现在Body标记之后,然后是命名空间。

eg. <soap:Body>
<MethodName xmlns="namespace">

您可以从这里获取这两个,然后使用 SOAP_Action = Namespace + MethodName 来获取 SOAPAction。

最后,URL 指的是运行服务的* .asmx文件的 URL。

于 2012-08-27T15:42:03.147 回答