我是肥皂新手,我已经遇到了问题!我正在使用肥皂4r宝石。
gem 'soap4r', :git => 'git://github.com/felipec/soap4r.git'
require 'soap/wsdlDriver'
require 'soap/rpc/driver'
require 'soap/mapping/mapping.rb'
我按如下方式初始化 rpc 驱动程序:
def initialize
@username = "username"
@password = "password"
endpoint = "https://someurl.php"
namespace = "abc:somenamespace"
@driver = SOAP::RPC::Driver.new(endpoint, namespace)
end
当我从浏览器访问端点时,出现此错误:
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode xsi:type="xsd:string">SOAP-ENV:Client</faultcode>
<faultactor xsi:type="xsd:string"/>
<faultstring xsi:type="xsd:string">Operation '' is not defined in the WSDL for this service
</faultstring>
<detail xsi:type="xsd:string"/>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
另外,当我从 irb 执行此操作时:
client = SOAP::WSDLDriverFactory.new("endpoint?wsdl").create_rpc_driver
我收到此错误:
RuntimeError: part: return cannot be resolved
from /home/sadiksha/.rvm/rubies/ruby-1.8.7-p358/lib/ruby/1.8/wsdl/soap/methodDefCreator.rb:144:in `rpcdefinedtype'
from /home/sadiksha/.rvm/rubies/ruby-1.8.7-p358/lib/ruby/1.8/wsdl/soap/methodDefCreator.rb:56:in `collect_rpcparameter'
.
.
.
但是当我这样做时:
client = SOAP::WSDLDriverFactory.new(endpoint).createDriver
并按下列出方法
client.methods(false)
我有一个方法获取名称。当我尝试通过client.getName({:用户名=>"用户名",:p assword =>"密码"(访问该方法时,它给我错误说
SOAP::FaultError: Username doesn't exist
from
很抱歉弄得太长了!我已经搜索了很长时间了。但未能找到具体答案。我希望有人能回答我的问题。我认为这可能是一些身份验证错误。
使用以下内容可以帮助您排除故障。它会将生成和接收的 XML 转储到控制台。
myWebServiceInstance.wiredump_dev = STDERR