问题标签 [soap-client]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
6081 浏览

xml-serialization - 尝试调用 Web 服务调用时出现“无法识别指定类型”异常

我正在尝试使用 WSE 3.0 作为 Visual Studio 2005 中的客户端调用第三方 Web 服务。

调用工作正常,我可以看到我得到了很好的响应(我启用了跟踪),但显然 xml 解析器阻塞了它。我总是得到一个InvalidOperationException

XML 文档中存在错误。

有一个InnerException

无法识别指定的类型:name='Map',namespace=' http ://xml.apache.org/xml-soap',位于 <bevoegdheid xmlns=''>。

这是响应的相关部分:

这就是在 wsdl 中定义“bevoegdheid”的方式:

wsdl 中的任何地方都没有提到“地图”类型。

我一直在谷歌搜索,但我发现的唯一答案是类似的

该服务使用较难实现互操作性的 rpc/编码格式。如果您可以将服务器更改为文档/文字,那就更好了。

但由于这是第三方服务(已被其他客户使用),这对我们来说是没有选择的。

还有其他建议吗?如何让 xml 解析器识别“地图”类型?

0 投票
1 回答
2265 浏览

php - 向我们传输文件 NuSOAP

我在使用 NuSOAP 传输文件时遇到问题。我了解您可以读取文件并将其作为字符串传输,但它不起作用。这是一个例子:

客户:

服务器:

这是真正奇怪的部分。如果我返回文件名或文件大小或类似的东西,它将起作用。它不会返回文件本身。请帮忙。

0 投票
1 回答
277 浏览

ruby-on-rails - What is the "Best Practice" for SOAP servers to implement error notification?

I am developing some SOAP web services using Ruby on Rails and considering how to handle generic failures. These generic errors are applicable to all the methods within the service and include the following :-

  • Missing Request element
  • Missing Authentication element (Custom)
  • Invalid Authentication details

I can intercept these errors within my controller before calling the relevant method and respond appropriately. My question is which implementation is easiest to manage from a Client perspective. My options for handling these errors seem to be as follows.

  1. Raise an exception and let the SOAP service generate a SoapFault. This would be fine except I have little (no) control over the structure of the message contained within the SOAP fault.
  2. Return an Http 400 response with an agreed data structure to indicate the error message. This structure would not be defined within the WSDL though.
  3. Include a Status element in all responses, whether successful or not and have that status element include a code and an array of error data (Including error messages).

Option three seems like the best solution but is also the most error prone to implement as the implementation of web services in ROR precludes me from implementing this in a generic way and each method becomes responsible for checking the result of the checks and rendering an appropriate response. Admittedly this would be a single function call and return on failure but it is relying on the developer to remember to do this as we add more options.

I appreciate that most ROR developers will say that this should be implemented as a REST service and I agree, in fact we already have REST services to do this but the spread of SOAP in the corporate world, and its impressive tooling support means that we have to provide SOAP services to remain competitive.

In your experience what would be the easiest implementation for clients to handle and does this differ dependant upon the libraries/language of the client process.

0 投票
1 回答
1350 浏览

php - 贝宝 SoapClient 不工作

我正在使用 PHP 的 SoapClient 类连接到贝宝。我有很多问题:

  1. 我传递给soap调用的参数是,array('ReturnAllCurrencies'=>0, 'Version'=>'63.0')但正如您在下面的请求中看到的那样,63.0放入<param1>任何内容。我什至没有在请求中看到 ReturnAllCurrencies。

在这个请求中,我正在执行一个GetBalance命令:

我通过 SoapClient::__getLastRequest() 找到了上面的请求。它看起来不像贝宝网站上的示例。GetBalanceReq标签怎么了?为什么它有 *Req 后缀?

2.使用生产服务器和wsdl文件时,出现php错误:

SOAP-ERROR:解析 WSDL:无法从“ https://www.paypal.com/wsdl/PayPalSvc.wsdl' ”加载;: 需要开始标签,'<' 未找到

此外,如果我尝试访问 FireFox ( https://api.paypal.com/2.0/ ) 中的生产证书 url,我会收到 ssl_error_handshake_failure_alert

我应该下载 wsdl 文件并在 SoapClient::__construct 的第一个参数中指向本地版本,还是应该简单地指向贝宝托管副本?我最初认为是后者,但现在我不确定

0 投票
6 回答
206993 浏览

c# - .NET 中的 SOAP 客户端 - 参考或示例?

背景:

我正在创建一个 Web 服务站点,它将通过 SOAP 和可能的其他协议提供多种类型的简单服务。目标是让转换、RSS 解析、垃圾邮件检查和许多其他类型的工作变得容易。该网站将主要针对初学者开发人员。

我的问题:

我从未为此开发过任何 C# 或 .NET。多年前我确实破解了一些 VB6,但仅此而已。现在我需要一些在 C# 中通过 SOAP 进行 RPC 调用的示例。我试图搜索网络和 Stack Overflow 来找到这个,但没有找到很多资源,我不知道如何对资源进行排名(哪些是旧的?哪些是不正确的?等等)。

我创建了一个简单的示例服务,在 PHP 中这样调用:

我现在想在 C# 中尽可能轻松地调用此方法。非常欢迎所有参考资料和示例。我从哪里开始?我可以使用哪些类/模块/什么?

如果有更好的通信框架(后端是可扩展的),该解决方案根本不必涉及 SOAP,但请注意,服务器端是在 Unix 上用 PHP 实现的,因此微软的专有解决方案是不可能的服务器端。

请注意,我需要这个,所以我可以为 J. Random Web Developer 编写可能的文档(即使他们在共享网络托管上)。因此,我认为最好的方法应该是仅在代码中执行此操作,但当然也欢迎其他方式执行此操作。

0 投票
3 回答
13626 浏览

php - 需要支付宝的简单 php SoapClient 示例

我可以得到一个简单的例子,使用 PHP 的 SoapClient 类对 Paypal 进行空调用,只有版本号?我有正确的 WSDL url 和服务器 url,所以这不是我需要帮助的。这就是我所拥有的:

我希望没关系,我没有展示所有内容。请求的正文完全错误,如下所示:

它应该如下所示:

当然,Paypal 会抛出“不支持版本”错误。

0 投票
2 回答
19788 浏览

java - Axis 安全标头

您好,尝试在 Java Axis2 客户端程序中生成格式为的安全标头。

使用以下代码

不幸的是,它并没有产生我想要的东西,我得到了。

另一端的服务似乎没有处理多余的位,导致错误

如何生成 SOAPHeader 以不打印出所有额外的空位?干杯

0 投票
2 回答
5102 浏览

perl - 使用 Perl 和 SOAP Lite 使用 .Net Web 服务

我正在尝试使用 perl 和 SOAP Lite 来使用 .Net Web 服务。

当我在 .Net 客户端中使用 Web 服务时,它会向 .asmx 端点发布以下内容:

如何使用 SOAP Lite 生成相同的请求?我浏览了各种 SOAP Lite 文档和文章,但都没有运气。到目前为止,我有以下内容:

这会生成这个不正确的 XML:

更新:

当我使用 fiddler 将第一个 xml 发布到我的服务时,它会返回我的“Hello World”结果。当我发布第二个时,我得到以下信息:

0 投票
2 回答
846 浏览

php - 使用 SOAP WDSL 和 PHP 的 Web 服务

我一直在尝试使用具有以下 WSDL 文件的 Web 服务。我不确定的一点是我应该通过或处理它的第一部分。它要求将具有 tns 类型的个人详细信息对象传递给它,但我不明白这是什么意思?我尝试使用的实际方法称为 PersonalDetails_Update ,我将所有相关值传递给它,但它一直失败,我怀疑它与它之前要求的这个 personadetails 对象有关?

0 投票
1 回答
1664 浏览

php - 在 php 中与没有 SoapClient 的 Web 服务交谈?

我对许多共享托管服务提供商没有在他们的托管环境上启用 SoapClient 支持感到非常恼火。通常,经过大量的乞求和咆哮,他们为我启用了它,但有时他们就是不让步。

那么,是否可以在不使用 SoapClient 类的情况下在 php 上使用 Web 服务?