我可以使用哪些程序来测试需要一些 SOAP HEADER 的 ASP.NET Web 服务?

发布于 2024-07-26 00:53:07 字数 1682 浏览 10 评论 0原文

我被要求对这个遗留应用程序进行一些错误测试。 Joy :( 这是一个用 C# 编写的简单 Web 服务 -> api.asmx。

现在,测试它的技巧是它需要一些 SOAP HEADER 进行身份验证。我知道我可以转到 asmx 页面,它给了我单击这些方法可以看到所有 GET/POST/SOAP 内容,如果我编辑 web.config,我就可以激活 Kewl 了。当然,我无法添加 SOAP HEADER,所以它失败了。

这是 SOAP xml 定义的内容:-

POST /services/api.asmx HTTP/1.1
Host: www.<snip>.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://webservice.<snip>.com/GetStuff"

<?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:Header>
    <ApiAuthentication xmlns="http://webservice.<snip>.com/">
      <DeveloperKey>string</DeveloperKey>
    </ApiAuthentication>
  </soap:Header>
  <soap:Body>
    <GetStuff xmlns="http://webservice.<snip>.com/">
      <StuffId>int</StuffId>
    </GetStuff >
  </soap:Body>
</soap:Envelope>

那么,我可以下载什么程序来测试这些内容?我尝试了 FIDDLER,但没有成功:(除非我这样做。干杯

编辑 1 和 2(添加删除线):

A 上一个SO问题建议SoapUI但那是java,我拒绝在我的电脑上安装java盒子....我不想拿出VirtualPC并将其扔在那里...好吗?

解决方案:

SoapUI(免费应用程序)通过 安装在虚拟 PC 上新手须遵循的说明 :)

I've been given this legacy app to do some bugtesting. Joy :( It's a simple webservice written in C# -> api.asmx.

Now, the trick for testing it, is that it requires some SOAP HEADER for authentication. I know I can just go to the asmx page, and it gives me all the api methods that are exposed. Clicking on those methods gives me a page where i can see all the GET/POST/SOAP stuff. If i edit my web.config, I can active the POST testing. Kewl. All that works. Of course, there's no way I can add in the SOAP HEADER, so it fails.

Here's the SOAP xml definition stuff :-

POST /services/api.asmx HTTP/1.1
Host: www.<snip>.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://webservice.<snip>.com/GetStuff"

<?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:Header>
    <ApiAuthentication xmlns="http://webservice.<snip>.com/">
      <DeveloperKey>string</DeveloperKey>
    </ApiAuthentication>
  </soap:Header>
  <soap:Body>
    <GetStuff xmlns="http://webservice.<snip>.com/">
      <StuffId>int</StuffId>
    </GetStuff >
  </soap:Body>
</soap:Envelope>

So, what program can I download to test this stuff out? I tried FIDDLER but with no luck :( Unless I've used it wrong.

Cheers!

Edit 1 & 2 (added strikethrough):

A previous SO question suggested SoapUI, but that's java and i refuse to install java on my box .... and i would prefer not to have to pull out a VirtualPC and throw that, on there... please?

Solution:

SoapUI (free app) installed on a Virtual PC with newbie instructions to follow :)

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

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

发布评论

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

评论(2

咆哮 2024-08-02 00:53:07

尽管这可能是显而易见的,但您需要提供 DeveloperKey 值,以便应用程序级安全机制授权您的请求。

这里有几点需要记住:

  • soapUI 具有轻松定义 Web 服务参数的功能。 这可能有助于测试这些遗留 Web 服务。 此外,您还可以使用 属性扩展,它允许您表示以下值:可能)在不同的(测试)Web 服务请求之间进行更改,或者您想要从您的soapUI 测试中以编程方式控制(即使用Groovy 脚本)。
  • 目前,soapUI 是用于测试 Web 服务的最强大的开源工具。 您可以下载独立版本的soapUI,它捆绑了JRE,以便安装的Java不会干扰计算机上安装的其余软件(即排除你大脑中的 Java 仇外部分 ;-))。
  • 无论以上两点如何,您实际上都不需要虚拟机来在沙箱中运行 Java 应用程序。 您只需安装 JRE 或 Java SDK 即可运行 Java 应用程序。 完成测试后,您可以随时卸载 Java (JRE/SDK) 和/或soapUI。

一旦您开始使用soapUI,您很快就会意识到它是一个非常强大的工具,并且它是用Java 实现的这一事实将变得无关紧要。

干杯!
尚齐

拉 JRE是Java运行时环境,运行Java应用程序需要它。 它类似于运行 .NET 应用程序所需的 .NET Framework 可再发行组件包。

Even though it may be obvious, what you need is to supply the DeveloperKey value in order to have your request authorized by application-level security mechanism.

Here's a couple of things to have in mind:

  • Among many other, soapUI has the feature to easily define web service parameters. This might be of help in testing those legacy web services. In addition, you can use Property Expansion which allows you to represent values that (may) change between different (test) web service request or that you want to control programamtically from within you soapUI tests (i.e. using Groovy scripts).
  • For the time being, soapUI is the most powerful open-source tool for testing web services. You can download the standalone version of soapUI which bundles JRE so that the installed Java does not interfere with the rest of software installed on your machine (i.e. excl. that Java xenophobic part of your brain ;-)).
  • Regardless of the two points above, you do really not need a virtual machine to run a Java application in a sandbox. All you need is JRE or Java SDK installed in order to run a Java app. Once you're done testing, you can always uninstall Java (JRE/SDK) and/or soapUI.

Once you start using soapUI you'll soon realize that it's a really powerful tool and the fact it's been implemented in Java will become irrelevant.

Cheers!
Shonzilla

p.s. JRE is Java Run-time Environment and it's needed to run Java applications. It's similar to .NET Framework redistributable package which is needed to run .NET applications.

自此以后,行同陌路 2024-08-02 00:53:07

如果您确实无法使用 SoapUI,有一个名为 SOAP Sonar 的“企业”工具。 我不知道它是什么样的,但它可能可以完成工作。

If you really can't use SoapUI, There is a "enterprise" tool called SOAP Sonar. I've no idea what it's like but it might do the job.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文