VB6 连接到 WCF

发布于 2024-11-29 20:09:32 字数 88 浏览 2 评论 0 原文

如何创建连接到 WCF Web 服务的 VB6 客户端?

有没有更好的解决方案来创建 Web 服务而不是使用 WCF,以便从 VB6 连接更容易?

How can I create a VB6 client connect to WCF web service?

Is there any better solution to create web service instead of using WCF, so that it is lot more easier to connect from VB6?

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

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

发布评论

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

评论(2

初懵 2024-12-06 20:09:32

这实际上取决于您的具体要求。以下是一些建议:

  1. 您可以编写一个具有对 WCF 服务的服务引用的 .NET 程序集,并在其中包含一个作为 COM 对象公开的包装类。您可以从中访问 VB6 Web 应用程序。唯一关心的是在这种情况下 app.config 文件的名称。通过 AppDomain.CurrentDomain.SetupInformation.ConfigurationFile 很容易找到 这个 stackoverflow 答案说明了。如果您的 VB6 应用程序与您的服务位于同一 LAN 上,则这样做的优点是允许您使用 netTcpBinding 其开销比 http 绑定更少。您还可以变得非常奇特,并使用类似 netMsmqBinding 的内容 如果您需要断开连接访问该服务。
  2. 已弃用的 Soap Toolkit 3.0 有一个 COM SOAP 客户端。如果我打算尝试使用它。
  3. 如果您的服务所采用的参数和返回的值相对简单,您可能需要考虑使用 webHttpBinding,进行原始 http 调用,并自己解析结果。

It really depends on what your requirements are exactly. Here are some suggestions:

  1. You can write a .NET assembly that has a service reference to the WCF service, and have a wrapper class in that that isexposed as a COM object. You can access the VB6 web app from that. The only concern is what the app.config file would be called in this case. That is easy enough to find out via AppDomain.CurrentDomain.SetupInformation.ConfigurationFile as this stackoverflow answer illustrates. If your VB6 app is on the same LAN as your service this will have the advantage of allowing you to use netTcpBinding which would have less overhead than the http bindings. You could also get really exotic and use something like netMsmqBinding if you need disconnected access to the service.
  2. The deprecated Soap Toolkit 3.0 has a COM SOAP client. I would probably stick to basicHttpBinding if I was going to attempt to use that.
  3. If your service is relatively simple in the parameters it takes and the values it returns, you might want to consider using webHttpBinding, making raw http calls, and parsing the results yourself.
静谧 2024-12-06 20:09:32

您可以找到有关用 VB6 编写 SOAP 客户端的文章 - 例如 这个

我会给你一些建议,让你看看替代的客户端或 Web 服务技术:

  1. 为什么要选择不同的 Web 服务技术,以便用 10 年前的版本编写客户端技术。我曾经是一名 VB6 程序员,所以我并不反对它 - 但为了使用相当古老的客户端技术而设计不同的服务似乎是一个奇怪的设计选择。你一定有你的理由,但我只是想挑战一下它们。
  2. 我最近编写了一个 WCF 客户端应用程序 - 使用 C# 中自动生成的代理 - 工作得很好。也就是说,Web 服务的 REST 架构有时更容易理解,并且可能是更适合 VB6 的替代方案。您的 Web 服务是否必须使用类似 SOAP 的架构?

我的建议是,如果您坚持使用 VB6 - 并且对于 Web 服务端很灵活 - 请看看 REST 架构。如果您想走 SOAP 之路 - WCF 对我来说非常有用,您应该能够在 VB6 中找到一些东西,但我会寻找有关在 VB6 中使用 SOAP 的文章,因为关于 VB6 的文章并不多和WCF。

You can find articles on writing a SOAP client in VB6 - such as this one

I would make some suggestions for you to look at alternative client or web-service technologies:

  1. Why go for a different web service technology in order to write the client in a 10 year old technology. I used to be a VB6 programmer, so I'm not anti it - but it seems a strange design choice to engineer a different service, for the purpose of using quite an old client technology. You must have your reasons, but I'd just like to challenge them a bit.
  2. I've written a WCF client application recently - using an auto-generated proxy in c# - worked fine. That said, a REST architecture for a web service is sometimes a little easier to understand and may be an alternative that would work better with VB6. Does your web service have to use a SOAP like architecture?

My recommendation is that if you are stuck with VB6 - and flexible for the web-service end - have a look at a REST architecture. If you want to go down the SOAP way - WCF has worked great for me, and you should be able to get something to work in VB6, but I would look for articles about using SOAP with VB6, as there will not be many about VB6 and WCF.

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