2012-05-13 47 views
0

我是新來肥皂,我已經有問題了!我正在使用soap4r寶石。soap4r SOAP :: FaultError

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 

I正在此錯誤:

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訪問方法({:用戶名=>「用戶名」,:密碼=>「密碼」),它給了我錯誤說

SOAP::FaultError: Username doesn't exist 
    from 

我爲使其太久對不起!我一直在尋找它很長一段時間。但無法找到具體的答案。我希望有人會回答我的問題。我在想這可能是一些認證錯誤。

+0

此錯誤是由身份驗證造成的,我輸入的用戶名和密碼錯誤! –

回答

0

使用以下內容可以幫助您解決正在發生的問題。它會將生成和接收的XML轉儲到控制檯。

myWebServiceInstance.wiredump_dev = STDERR 
相關問題