Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net WCF中继服务数据对象的问题_.net_Vb.net_Web Services_Wcf_Soap - Fatal编程技术网

.net WCF中继服务数据对象的问题

.net WCF中继服务数据对象的问题,.net,vb.net,web-services,wcf,soap,.net,Vb.net,Web Services,Wcf,Soap,我正在编写一个中间人WCFSOAP服务,它将位于客户端和目标之间。目标端点被拆分为两个具有相同操作签名的服务,中继服务的任务是确定客户端数据需要发送到其中的哪一个,然后发送它 因此,考虑到这一点,我正在尝试在我的中继wcf服务中重用目标接口,以便客户端可以连接到我的中继,而无需任何更改。在测试中,我在尝试调用目标调用时出现以下错误: 尝试序列化参数时出错 processDoc。InnerException消息 数据合约名称为'Type'InputDoc' “InputDoc:”是 没有预料到。考

我正在编写一个中间人WCFSOAP服务,它将位于客户端和目标之间。目标端点被拆分为两个具有相同操作签名的服务,中继服务的任务是确定客户端数据需要发送到其中的哪一个,然后发送它

因此,考虑到这一点,我正在尝试在我的中继wcf服务中重用目标接口,以便客户端可以连接到我的中继,而无需任何更改。在测试中,我在尝试调用目标调用时出现以下错误:

尝试序列化参数时出错 processDoc。InnerException消息 数据合约名称为'Type'InputDoc' “InputDoc:”是 没有预料到。考虑使用DATACONTractRelver或添加任何类型 已知类型列表中静态未知的-例如 使用KnownTypeAttribute属性或将其添加到列表中 已传递给DataContractSerializer“”的已知类型的。请看 有关详细信息,请参阅InnerException

我怀疑问题在于我编写了一个糟糕的接口。我的接口包含从目标服务的InputDoc类继承的InputDoc类的数据约定。有人能解释一下我是如何成功地将这个对象传递给目标服务的吗

我的界面:

<ServiceContract()>
Public Interface IRelayService

    <OperationContract()>
    Function processDoc(ByVal inputDoc As InputDoc) As ResultResposne
End Interface


<DataContract(), _
 System.Xml.Serialization.XmlTypeAttribute([TypeName]:="InputDocument", [Namespace]:="http://test.net/")>
Partial Public Class InputDoc
    Inherits TargetService.InputDoc
End Class

公共接口服务
函数processDoc(ByVal inputDoc作为inputDoc)作为结果
端接口
部分公共类InputDoc
继承TargetService.InputDoc
末级
使用以下信息:

您是否尝试过用[KnownType(typeof(InputDoc)]装饰包含InputDoc类的类


我会阅读上面提到的SO问题,希望这对您的项目结构有意义。我不熟悉您的项目结构,因此我很难向您提供放置[KnownTYpe(typeof())]的确切细节

据我所知,没有包含InputDoc的类。InputDoc继承自Target.InputDoc并由processDoc调用,它本身不包含在任何其他类中。