I have filed a bug to track these issues:
http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=3279
Tomas
-Original Message-
From: users-boun...@lists.ironpython.com
[mailto:users-boun...@lists.ironpython.com] On Behalf Of Pavel Suhotyuk
Sent: Tuesday, December 01, 2009 5:27 AM
To: Discussion of IronPython
Subject: Re: [IronPython] Using ruby module from python.
I try your example. It's really work, but have some problem with ruby
objects:
1) Can't call RubyObject methods.
>>> import clr
>>> wsdl = clr.Use('wsdl.rb', 'rb')
>>> factory = wsdl.get_factory()
>>> client =
factory('http://localhost/PaymentsBroker/Manager/ProviderService.asmx?WSDL').create_rpc_drive()
Traceback (most recent call last):
File "", line 1, in
AttributeError: 'RubyObject' object has no attribute 'create_rpc_drive'
>>> client =
getattr(factory('http://localhost/PaymentsBroker/Manager/ProviderService.asmx?WSDL'),
'create_rpc_driver')()
>>>
2) Calling methods without parameters possible.
>>> client.GetProviders(None)
]>
But I don't understand how call methods with parameters. In ruby I can call
like this:
>>> print client.GetBalance(:providerId => 3).getBalanceResult().balance
>>> 60663.89=> nil In python it's not work:
>>> client.GetBalance(3)
Traceback (most recent call last):
File "", line 1, in
SystemError: SOAP::Mapping::MappingError >>> client.GetBalance(provider=3)
Traceback (most recent call last):
File "", line 1, in
TypeError: RubyMethod is not callable
>>> getattr(client, 'GetBalance')(3)
Traceback (most recent call last):
File "", line 1, in
SystemError: SOAP::Mapping::MappingError >>> getattr(client,
'GetBalance')(provider=3) Traceback (most recent call last):
File "", line 1, in
TypeError: RubyMethod is not callable
>>> getattr(client, 'GetBalance')({'providerId':3}) Traceback (most recent
>>> call last):
File "", line 1, in
SystemError: SOAP::Mapping::MappingError >>> getattr(client,
'GetBalance')({'providerId':3}) Traceback (most recent call last):
File "", line 1, in
SystemError: SOAP::Mapping::MappingError >>> getattr(client,
'GetBalance')({':providerId':3}) Traceback (most recent call last):
File "", line 1, in
SystemError: SOAP::Mapping::MappingError
Tomas Matousek wrote:
> Our Python-Ruby interop is not quite done yet so you need to use some
> workarounds.
>
> The easiest way how to get WSDL factory instance would be to write a simple
> Ruby script that loads it:
>
> == wsdl.rb ==
>
> require 'soap/wsdlDriver'
>
> def get_factory
> SOAP::WSDLDriverFactory
> end
>
> ===
>
> And then you can do:
import clr
wsdl = clr.Use('wsdl.rb', 'rb')
factory = wsdl.get_factory()
print factory("x.wsdl")
> Traceback (most recent call last):
> File "", line 1, in
> SystemError: Cannot connect to x.wsdl (Not HTTP.)
>
>
> get_factory method is exposed on the "wsdl" module so that Python can call
> it. IronRuby doesn't yet implement dynamic protocols for constant access so
> you need the get_factory helper for accessing Ruby constants.
> Also we have some work to do to make clr.Use work better with libraries of
> other DLR languages.
> Let us know if you hit some other issues.
>
> Tomas
>
>
> -Original Message-
> From: users-boun...@lists.ironpython.com
> [mailto:users-boun...@lists.ironpython.com] On Behalf Of Pavel
> Suhotyuk
> Sent: Monday, November 30, 2009 2:38 AM
> To: Discussion of IronPython
> Subject: [IronPython] Using ruby module from python.
>
> Hello.
>
> I want try to use ruby library (soap) in python code.
> I found method Use(str) in clr module for load the specified module searching
> all languages in the loaded ScriptRuntime, but don't understand how to used
> it.
>
> I try to call this method in any variants, but nothing happends.
>
> >>> import clr
> >>> clr.Use('soap/wsdlDriver')
> Traceback (most recent call last):
>File "", line 1, in
> ValueError: couldn't find module soap/wsdlDriver to use >>>
> clr.Use('soap.wsdlDriver') Traceback (most recent call last):
>File "", line 1, in
> ValueError: couldn't find module soap.wsdlDriver to use >>>
> clr.Use('soap/wsdlDriver.rb') Traceback (most recent call last):
>File "", line 1, in
> ValueError: couldn't find module soap/wsdlDriver.rb to use >>>
> clr.Use(r'''C:\usr\env\IronRuby\lib\ruby\1.8\soap\wsdlDriver.rb''',
> 'rb')
>
> >>> m =
> clr.Use(r'''C:\usr\env\IronRuby\lib\ruby\1.8\soap\wsdlDriver.rb''',
> 'rb') >>> m >>> dir(m) ['__builtins__']
>
>
> Thanks.
> ___
> Users mailing list
> Users@lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
> ___
> Users mailing list
> Users@lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/list