【问题标题】:Parameters for SOAP client connectionSOAP 客户端连接的参数
【发布时间】:2012-08-27 15:40:18
【问题描述】:

我为 android 客户端应用程序使用 asmx Web 服务。对于下面编写的示例 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

【问题讨论】:

  • @Peter 你是什么意思?我的英语不完美。
  • RESTful 服务类似于 SOAP(web-services too),但它们被简化为更简单的函数,如 POST、GET、REQUEST,以便它们可以在需要 http vogella.com/articles/REST/article.html 的服务中轻松实现跨度>
  • @Peter 谢谢你的建议,但我必须使用肥皂网络服务。

标签: android web-services ksoap2


【解决方案1】:

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

SOAP_Method = "HelloThere"

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

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

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

SOAPAction 已在 WSDL 中提及,因此您可以从那里使用它。

SOAPAction = 命名空间 + 方法名

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

此外,MethodName 位于 Body 标记之后,然后是命名空间。

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

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

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

【讨论】:

  • 我改进了问题,我应该使用什么作为 url?
  • @gurcan15 :更新了我的答案。 :)
  • 感谢您的回答,我需要了解这些参数是如何产生的。(例如:method_name="GetKullaniciBilgileri" 它来自 body 标签之后)。我这样问,因为在某些示例中它使用不同,例如:“localhost:56053/WebSite1/WebService.asmx?wsdl”而不是“localhost:56053/WebSite1/WebService.asmx
  • 您的网络服务在您的本地机器上运行。我无法查看它们。如果您需要进一步说明,您需要将 WSDL 粘贴到问题中。 :)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-03-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多