我是肥皂新手,我已经遇到了问题!我正在使用soap4r gem。
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)
我有一种方法getName。当我尝试通过 client.getName({:username => "username", :password => "password") 访问该方法时,它给了我错误提示
SOAP::FaultError: Username doesn't exist
from
我很抱歉让它太长了!我已经搜索了很长时间了。但没能找到具体的答案。我希望有人能回答我的问题。我认为这可能是一些身份验证错误。