I have a WCF service that I wrote in C#. This is hosted as a windows service
and I can happily connect to it from
a C# client by adding a service reference to the aforementioned service within
the (using VS 2008) client project.
I would like to connect to the same serivce via IronPython if possible.
If I execute an IronPython script on the local machine where the service exists
I am able to
use "clr" etc in to add a reference to the *.dll and utilize the service in
that manner without issue.
i.e.
import clrclr.AddReferenceToFileAndPath("<somePath>\serviceName.dll")import
serviceNameLibclient = serviceNameLib.service()client.doSomethingFromService()
However, my goal is to connect to the service that is running like I am doing
in the C# client example (using the service reference add
functionality) and not directly to the assembly. I guess the issue is related
to the fact that the service reference add invokes the svcutil
which generates all that lovely code for the C# app in order for me to simply
connect the C# client to the service.
I have been experimenting in IronPython but my lack of knowledge in both Python
and WCF in general has stumped me and I don't seem
to be able to find anything online that has an example of an IronPython client
in this regard.
My expermintation has been along the lines of:
import clr
clr.AddReferenceToFileAndPath("<somePath>\serviceName.dll")
clr.AddReference("System")
clr.AddReference("System.ServiceModel")
import System
import System.ServiceModel
import serviceNameLib
uri = System.Uri("http://<address>:8080/serviceName")
binding = System.ServiceModel.WSHttpBinding()
host = System.ServiceModel.ServiceHost(type(serviceNameLib.service))
host.AddServiceEndpoint(serviceNameLib.Iservice, binding, uri)
The contract name 'serviceNameLib.Iservice' could not be found in the list of
contracts implemented by the service 'IronPython.Runtime.Types.ReflectedType'.
The final line (in red) is the error I get. Obviously I am missing something
large or perhaps it simply isn't possible the way I am trying to do it. If
anyone can put me out of my coding misery it would be appreciated.
cheers
_________________________________________________________________
All new Live Search at Live.com
http://clk.atdmt.com/UKM/go/msnnkmgl0010000006ukm/direct/01/_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com