动态wcf客户端代理和调用方法返回类型不匹配 [英] dynamic wcf client proxy and call method return type mismatch
问题描述
当我使用wcf从生成代理客户端调用方法时出现问题。
问题是服务合同中定义的方法返回的类型与类中定义的类型不同。
[DataContract(Name = Foo)]
公共类Fii {}
和方法返回的类型是Foo但我不知道如何在不改变DataContract属性的情况下将Foo类型解析为Fii类型。
i使用了knowntype和knownServiceType但没有。
(我得到一个带有wsdl链接的uri,我通过代码生成代理并且一切正常)
任何人都可以帮助我吗?
谢谢,
虽然问题描述对我来说不太清楚,但我建议你看一下这篇文章< a href =http://geekswithblogs.net/SoftwareDoneRight/archive/2010/04/14 /solving-ldquoxmlschemaexception-the-global-element-ltelementnamegt-has-already-been-declared.rdquo.aspx\">http://geekswithblogs.net/SoftwareDoneRight/archive/2010/04/14/solving-ldquoxmlschemaexception-the- global-element-ltelementnamegt-has-been-declared-declared.rdquo.aspx 。
这家伙似乎有些麻烦,因为他在他的DataContract类型名称中使用了一些WCF保留字。例如,在类型ActivateSoftwareRequest(请求似乎导致问题)。可能是你的Fii或Foo包含WCF保留字。
检查它。
问候
Hi,
I have a problem when i call a method from a generate proxy client with wcf.
The problem is that the returned type from the method defined in the service contract is different that type the defined in a class.
[DataContract(Name="Foo")]
public class Fii{}
and the type returned by the method is Foo but i don''t known how to resolve the Foo type to Fii type without changing the DataContract attribute.
i have used the knowntype and knownServiceType but nothing.
(i get a uri with a wsdl link and i do all by code to generate the proxy and all is ok)
Can anyone help me?
Thanks,
Although the problem desccription is not quite clear for me, I will suggest you have a look at this post http://geekswithblogs.net/SoftwareDoneRight/archive/2010/04/14/solving-ldquoxmlschemaexception-the-global-element-ltelementnamegt-has-already-been-declared.rdquo.aspx.
The guy seems to have some troubles due to the fact that he his using some WCF reserved words in his DataContract types name. For example, in the type ActivateSoftwareRequest (Request seems to cause problem). May be your Fii or Foo contains WCF reserved word.
Check for it.
Regards
这篇关于动态wcf客户端代理和调用方法返回类型不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!