(soap:服务器) 服务器无法处理请求。 --->未将字符串引用设置为字符串的实例。参数名称:s

发布于 2024-09-07 04:22:29 字数 781 浏览 6 评论 0原文

我正在使用 savon 来使用 API。以下是我的代码行。

 wSDL = "some_wsdl"
 client = Savon::Client.new(wSDL)     
 response = client.soap_action do |soap|
 soap.body = "<sample>string_value</sample>" , "<sample1>string_value</sample1>"
 end

我收到错误(标题),下面是应用程序跟踪。 顺便说一句,我的 wsdl 格式为 https://some_wsdl 格式,如果这很重要的话。

/var/lib/gems/1.8/gems/savon-0.7.9/lib/savon/response.rb:141:in `handle_soap_fault'
/var/lib/gems/1.8/gems/savon-0.7.9/lib/savon/response.rb:81:in `initialize'
/var/lib/gems/1.8/gems/savon-0.7.9/lib/savon/client.rb:95:in `new'
/var/lib/gems/1.8/gems/savon-0.7.9/lib/savon/client.rb:95:in `method_missing'
app/controllers/deposit_controller.rb:33:in `deposit'

I am using savon to consume an API. Below are lines from my code.

 wSDL = "some_wsdl"
 client = Savon::Client.new(wSDL)     
 response = client.soap_action do |soap|
 soap.body = "<sample>string_value</sample>" , "<sample1>string_value</sample1>"
 end

I am getting an error (title) and below is the application trace.
Btw, my wsdl is in https://some_wsdl format, if that matters.

/var/lib/gems/1.8/gems/savon-0.7.9/lib/savon/response.rb:141:in `handle_soap_fault'
/var/lib/gems/1.8/gems/savon-0.7.9/lib/savon/response.rb:81:in `initialize'
/var/lib/gems/1.8/gems/savon-0.7.9/lib/savon/client.rb:95:in `new'
/var/lib/gems/1.8/gems/savon-0.7.9/lib/savon/client.rb:95:in `method_missing'
app/controllers/deposit_controller.rb:33:in `deposit'

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

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

发布评论

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

评论(1

单身狗的梦 2024-09-14 04:22:29

不知道为什么你会收到错误,但你通过将肥皂体构建为绳子而让生活变得困难。 Savon 从哈希构建 SOAP 请求,因此以下内容将更轻松地完成您想要的事情

wSDL = "some_wsdl"
client = Savon::Client.new(wSDL)     

# Add more details here including nested hashes    
request_hash = {
  "sample" => string_value,
  "sample1" => string_value
}

response = client.soap_action do |soap|
  soap.body = request_hash
end

Not sure why you are getting the error but you are making life difficult by building the soap body as a string. Savon build SOAP requests from Hashes so the following will do what you want somewhat more easily

wSDL = "some_wsdl"
client = Savon::Client.new(wSDL)     

# Add more details here including nested hashes    
request_hash = {
  "sample" => string_value,
  "sample1" => string_value
}

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