[Ironruby-core] Having difficulties using custom C# dlls with namespaces within IronRuby code

Ivan Porto Carrero ivan at flanders.co.nz
Thu Jun 12 09:04:08 EDT 2008

For me that just works with a namespace
what I do is I have my assemblies in a folder bin in my application but that
could be what ever

I call require 'bin/AssemblyName.dll'

In that assembly I have a namespace MyNamespace.Model

then I can do
include MyNamespace::Model

if that namespace contains a class called Message I can now use it as
message = Message.new
message.content = "The body of the test message"

puts message.content

I don't know if you know about this but Rails 2.0 has a component
ActiveResource which should replace ActiveWebservice.
That component allows you to use the resources (if you're using the restful
routing that is) you've exposed for your rest application and on the client
side you can use that same active resource stuff to create proxies and do
queries against that rest service in a fairly nice way.

hope this helps

On Fri, Jun 13, 2008 at 12:36 AM, Philippe Monnet <ironruby at monnet-usa.com>

>  Now that the Beta 2 of Silverlight provides support for WSI web services,
> I can now get an all-C# Silverlight app to call Rails (Action Web Service)
> web services.
> So I encapsulated my generated web service proxy in its own DLL so I can
> use it from Ruby, like so:
> ...
> require "System.ServiceModel"
> require "mywebsvcproxy" #my DLL
> ...
> include System::ServiceModel
> *include mywebsvcproxyns*
> ...
> svcproxy = mywebsvcproxyns::MyRoRServiceReference::MyRorWsPortClient.new()
> ... etc ...
> However I keep getting an error as soon as I hit the include for my
> assembly namespace.
> I have tried to simplify the issue by creating a very tiny assembly with a
> C# class with 2 properties and a constructor but I get the same issue.
> I even tried that from IR with the same results:
>   - the require "mywebsvcproxy" returns true
>   - if I evaluate mywebsvcproxyns I get undefined
> The DLL is in the same location as other .rb files in my Silverlight app
> directory. I have even tried to provide an absolute path in the require
> statement but that did not make any difference.
> After putting this email on hold for another check, I found out that as
> soon as I remove the namespace inside my custom assembly everything works
> like a charm. I ended up also removing all namespace references in the C#
> generated proxy and was able to get my IronRuby Silverlight app to
> successfully invoke my Rails web service.
> But coming back to the namespace issue, am I missing something basic in how
> I should be integrating with custom assemblies?
> Or is this a limitation for the time being?
> Philippe
> _______________________________________________
> Ironruby-core mailing list
> Ironruby-core at rubyforge.org
> http://rubyforge.org/mailman/listinfo/ironruby-core
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20080613/893e030e/attachment-0001.html>

More information about the Ironruby-core mailing list