How do I use Ruby's SOAP::Attachment class?

一世执手 提交于 2020-01-04 14:31:25

问题


So I'm writing a Ruby client for a SOAP web service, and I've figured out how to call a simple method:

# WebServiceClient.rb
require 'soap/wsdlDriver'

wsdl_url  = 'http://urlmadness?wsdl'
service = SOAP::WSDLDriverFactory.new(wsdl_url).create_rpc_driver
result = service.simpleMethod(:sayHello => 'Hello')

p result.return

Now I need to write something that will call a web method that is expecting an attached file as a SOAP MIME Attachment (SwA). I've looked into Ruby's SOAP::Attachment class but I can't seem to figure out how to use it, and I can't find any examples anywhere.

Does anybody know how to use it to add a MIME attachment to a method call?

Thanks,
Alex


回答1:


found two discussions in the soap4r google group:

"How to add attachment to doc/lit soap request?"
http://groups.google.com/group/soap4r/browse_frm/thread/1cfc1f87c5cbdda7/a8f58915d4a2de87?lnk=gst&q=attachment#a8f58915d4a2de87

ps. second link added as a comment.
i'm not allowed to post more than one link in an answer due to spam protection



来源:https://stackoverflow.com/questions/2329802/how-do-i-use-rubys-soapattachment-class

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!