如何获取 XML 形式的 SOAP 标头?

发布于 2024-09-11 10:11:15 字数 222 浏览 5 评论 0原文

如何获取 xml 形式的 Web 服务函数的 SOAP 标头?

我需要工作 SOAP 标头的 XML 版本,以作为 SOAP 标头损坏的用户的示例。他使用的是不同的编程语言,但由于标头以 XML 形式发送,我们希望能够轻松地比较它们。我使用的是 C#,ToString() 只是提供对象的名称。谷歌搜索后,我尝试了 Fiddler,但没有发现任何东西,而且 SOAP 扩展对于看似非常简单的任务来说看起来太复杂了。

How can I get the SOAP header of my web service function as xml?

I need an XML version of my working SOAP header to use as an example for someone with broken SOAP headers. He's using a different programming language, but since the headers are sent in XML, we're hoping we can compare those easily. I'm using C# and ToString() just gives me the name of the object. After googling, I tried Fiddler, but that didn't catch anything, and SOAP Extensions look way too complicated for what seems like a really simple task.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

笔落惊风雨 2024-09-18 10:11:15

使用 ASMX Web 服务没有简单的方法可以做到这一点。如果您使用 WCF,打开消息日志记录将是一件小事。

Fiddler 应该能捕获所有内容,并且非常值得学习如何使用。请务必查看在线文档以了解如何捕获从本地主机到本地主机的流量。

There is no easy way to do this with ASMX web services. If you were using WCF, it would be a trivial matter of turning on message logging.

Fiddler should catch everything, and it's well worth learning how to use. Be sure to look in the online documentation to learn how to capture traffic from localhost to localhost.

指尖上的星空 2024-09-18 10:11:15

此问题的可接受答案提到您可以使用soapUI 捕获Web 服务的流量。您可以使用它作为代理或 HTTP 隧道来捕获发送到您的 Web 服务的消息。我认为在 HTTP 隧道模式下使用它是有意义的,因为这样您就不必对客户端执行任何操作,只需将 URL 指向soapUI 而不是您的实际服务。

soapUI 网站讨论了 SOAP Monitor 功能,不认为它为设置 HTTP 隧道提供了很好的解释。

以下是所涉及的步骤(基于soapUI 3.0.1):

  1. 打开Soap UI
  2. 创建一个新的soapUI 项目...
    2.1 给你的项目起一个名字
    2.2 输入服务 WSDL 的路径 (http://localhost/.../YourService.asmx ?WSDL)
  3. 右键单击​​刚刚创建的项目
  4. 选择“Launch SOAP Monitor”
  5. 选择“HTTP Tunnel”
  6. 为“Port”指定一个未使用的端口号。默认的可能会起作用。
  7. 在“设置 HTTP 隧道端点”中输入 Web 服务的 URL
  8. 如果您使用 SSL,则可能需要填写其他一些字段;否则,单击“确定”
  9. HTTP 隧道正在运行,因此现在只需重新配置客户端以使用 HTTP 隧道而不是实际的 Web 服务。因此,如果您的实际服务是“http://localhost:1234/YourService.asmx”,则重新配置您的客户端使用“http://localhost:{Port}/YourService.asmx”,其中 {Port} 是您输入的号码在步骤#6中。
  10. 现在正常运行你的客户端即可。您将看到在soapUI 界面中记录的流量。选择一条消息并单击窗口底部的“消息内容”按钮即可查看实际的 SOAP 消息。

The accepted answer to this question mentions that you can capture traffic to a web service using soapUI. You can use it to act as a proxy or HTTP tunnel in order to capture messages sent to your web service. I think using it in HTTP Tunnel mode makes sense, because then you won't have to do anything with your client other than to point the URL to soapUI instead of your actual service.

The soapUI website talks about the SOAP Monitor feature, though I don't think it offers a good explanation for setting up the HTTP tunnel.

Here are the steps involved (based on soapUI 3.0.1):

  1. Open Soap UI
  2. create a New soapUI Project...
    2.1 Give your project a name
    2.2 Enter the path to your service's WSDL (http://localhost/.../YourService.asmx?WSDL)
  3. Right-click on the project you just created
  4. Select "Launch SOAP Monitor"
  5. Choose "HTTP Tunnel"
  6. Specify an unused port number for "Port". The default will probably work.
  7. Enter the URL to your web service in "Set endpoint for HTTP Tunnel"
  8. If you are using SSL, then you may need to fill in some of the other fields; otherwise, click OK
  9. The HTTP tunnel is running, so now just reconfigure a client to use the HTTP tunnel instead of the actual web service. So if your actual service is "http://localhost:1234/YourService.asmx", then reconfigure your client to use "http://localhost:{Port}/YourService.asmx" where {Port} is the number you entered in step #6.
  10. Now just run your client normally. You'll see the traffic logged in the soapUI interface. Select a message and click on the "Message Content" button at the bottom of the window to view the actual SOAP message.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文