Calling WCF from IronPython does not return a complex type
I'm calling a WCF Service function
[OperationContract]
ProcessInfo GetPr开发者_如何学CocessInfo(); # ProcessInfo has a DataContract Attribute.
written in C# from a IronPython Script (v2.7).
The debugger proofs that the service is called and a correct object is returned.
But in the IPy script
import clr
clr.AddReference('System.ServiceModel')
import System.ServiceModel
clr.AddReference('Company.Service.Util')
from Company.Service.Util.Diagnostics import IServiceInspector
bind = System.ServiceModel.BasicHttpBinding()
endpoint = System.ServiceModel.EndpointAddress("http://localhost:40099/ServiceInspector")
channel = System.ServiceModel.ChannelFactory[IServiceInspector](bind, endpoint)
client = channel.CreateChannel()
pi = client.GetProcessInfo()
print "GetProcessInfo() returned:\n%s" % pi
None is received.
Both basicHttpBinding and tcpBinding have the same behaviour.
Try to run the script with debug info: ipy.exe -X:Debug -X:ExceptionDetail
Try simplier service (e.g. return string) - I guess you might need to add reference to System.Web
assembly where ProcessInfo
is stored.
精彩评论