开发者

Calling WCF from IronPython does not return a complex type

开发者 https://www.devze.com 2023-04-02 14:45 出处:网络
I\'m calling a WCF Service function [OperationContract] ProcessInfo GetPr开发者_如何学CocessInfo(); # ProcessInfo has a DataContract Attribute.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号