是什么导致 VBA Soap Service 调用中出现此 SoapMapper 错误?

发布于 2024-10-19 17:58:06 字数 756 浏览 4 评论 0原文

我正在尝试从 Excel 2003 工作簿中的 VBA 代码使用基于 Java 的 SOAP Web 服务。有两种方法可用。一个检索数据,另一个上传数据。检索数据的服务工作正常。然而,当我们尝试上传数据时,我们遇到了一个奇怪的错误,我在 Google 上找不到有关该错误的详细信息。错误消息是:

Run-time error '-2147221504 (800040000)';
SoapMapper: Putting data into SoapMapper element failed

如果我们尝试从 .NET 应用程序使用相同的 Web 服务,则生成的类和方法看起来略有不同。例如,获取数据服务调用采用 DataContainer 对象,该对象具有一些标识属性来确定要获取哪些数据。然后,它返回填充了数据的相同类型的对象。

在 Web Reference Toolkit 生成的 VBA 类中,获取和保存都采用相同类型的对象。但在 .NET 中,保存需要一个 SaveDataContainerDetails 对象。

所以有几个问题:

  • 有人在 VBA 工作中见过 SoapMapper 错误吗?

  • 有人见过 .NET 和 VBA 从同一个 WSDL 生成不同的方法签名吗?是什么导致了这个问题?我该如何解决这个问题?

  • 是否有比使用 Web 参考工具包和 SOAP 工具包更好的方法从 VBA 调用 SOAP 服务?

I'm trying to consume a Java based SOAP web service from VBA code in an Excel 2003 workbook. There are two methods available. One retrieves data, the other uploads data. The service for retrieving data works fine. However, when we try to upload data, we're running into a strange error that I just cannot find good information about on Google. The error message is:

Run-time error '-2147221504 (800040000)';
SoapMapper: Putting data into SoapMapper element failed

If we try to consume the same web service from a .NET application, it looks like the generated classes and methods are slightly different. For example, the fetch data service call takes a DataContainer object which has some identifying properties to determine what data to get. Then it returns the same type of object with the data filled in.

In the VBA classes generated by the Web Reference Toolkit, both fetch and save take the same type of object. But in .NET, the save takes a SaveDataContainerDetails object.

So a couple questions really:

  • Has anyone seen the SoapMapper error before in their VBA work?

  • Has anyone seen .NET and VBA generate different method signatures from the same WSDL? What could cause that and how could I work around it?

  • Is there a better way to call SOAP services from VBA rather than using the Web Reference Toolkit and the SOAP Toolkit?

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

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

发布评论

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

评论(2

剪不断理还乱 2024-10-26 17:58:06

我已经弄清楚这里的问题了。 VBA Soap Toolkit 和 Web References Toolkit 无法处理复杂类型的数组。上面的错误消息有些误导,因为“element”实际上是 Soap 信封中 XML 元素的名称。因此它无法将数据放入名为“element”的元素中。这有点掩盖了问题。

所以我确定这一切都归结为复杂类型的数组。我还确定,在 VBA 中自己制作肥皂信封要容易得多。所需的 XML 通常结构良好,创建和/或解析也不太困难。因此,如果您在使用 VBA 中的 Soap Toolkit 或 Web References Toolkit 时遇到问题...请不要使用它! :)

I've figured out the issue here. The VBA Soap Toolkit and Web References Toolkit just can't handle array's of complex types. The error message above was somewhat misleading because "element" was actually the name of the XML element in the Soap envelope. So it was failing to put data into an element called "element". That was masking the issue a bit.

So I've determined it all boiled down to arrays of complex types. I've also determined that it's MUCH easier to just craft the soap envelopes my self in the VBA. The XML required is generally pretty well structured and not too difficult to create and or parse. So, if you're having trouble with the Soap Toolkit or the Web References Toolkit in VBA... just don't use it! :)

往日情怀 2024-10-26 17:58:06

使用 VBA、VBSCRIPT、经典 ASP 等 Web 服务的最佳方法是使用 .NET 创建客户端。然后将您的客户端变成 COM 对象。这些很容易被这些旧技术消耗掉。

The best way to consume web services from VBA, VBSCRIPT, Classic ASP, etc. is to create your client using .NET. Then turn your client into a COM object. These are easily consumed by these older technologies.

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