<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body class='hmmessage'>
I have a WCF service that I wrote in C#.&nbsp; This is hosted as a windows service and I can happily connect to it from<br>a C# client by adding a service reference to the aforementioned service within the (using VS 2008) client project.<br><br>I would like to connect to the same serivce via IronPython if possible.<br><br>If I execute an IronPython script on the local machine where the service exists I am able to<br>use "clr" etc in to add a reference to the *.dll and utilize the service in that manner without issue.<br><br>i.e.<br><span style="font-weight: bold;">import clr</span><br style="font-weight: bold;"><span style="font-weight: bold;">clr.AddReferenceToFileAndPath("&lt;somePath&gt;\serviceName.dll")</span><br style="font-weight: bold;"><span style="font-weight: bold;">import serviceNameLib</span><br style="font-weight: bold;"><span style="font-weight: bold;">client = serviceNameLib.service()</span><br style="font-weight: bold;"><br style="font-weight: bold;"><span style="font-weight: bold;">client.doSomethingFromService()</span><br style="font-weight: bold;"><br>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<br>functionality) and not directly to the assembly.&nbsp; I guess the issue is related to the fact that the service reference add invokes the svcutil<br>which generates all that lovely code for the C# app in order for me to simply connect the C# client to the service.<br><br>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<br>to be able to find anything online that has an example of an IronPython client in this regard.<br><br>My expermintation has been along the lines of:<br><span style="font-weight: bold;">import clr<br style="font-weight: bold;"></span>
<span style="font-weight: bold;">clr.AddReferenceToFileAndPath("&lt;somePath&gt;\serviceName.dll")<br>clr.AddReference("System")<br>clr.AddReference("System.ServiceModel")<br>import System<br>import System.ServiceModel<br style="font-weight: bold;"></span>
<span style="font-weight: bold;">import serviceNameLib<br><br>uri = System.Uri("http://&lt;address&gt;:8080/serviceName")<br>binding = System.ServiceModel.WSHttpBinding()<br>host = System.ServiceModel.ServiceHost(type(serviceNameLib.service))<br><br>host.AddServiceEndpoint(serviceNameLib.Iservice, binding, uri)<br><br><span style="color: rgb(255, 0, 0);">The contract name '</span></span><span style="font-weight: bold; color: rgb(255, 0, 0);">serviceNameLib.Iservice</span><span style="font-weight: bold;"><span style="color: rgb(255, 0, 0);">' could not be found in the list of contracts implemented by the service 'IronPython.Runtime.Types.ReflectedType'.</span><br><br></span>The final line (in red) is the error I get.&nbsp; Obviously I am missing something large or perhaps it simply isn't possible the way I am trying to do it.&nbsp; If anyone can put me out of my coding misery it would be appreciated.<br><br>cheers<span style="font-weight: bold;"><span style="font-weight: bold;"></span><br></span><br /><hr />Miss your Messenger buddies when on-the-go? <a href='http://clk.atdmt.com/UKM/go/msnnkmgl0010000001ukm/direct/01/' target='_new'>Get Messenger on your Mobile!</a></body>
</html>