I'm in the process of writing a middle-man WCF SOAP service which will sit between the client and the target. The target endpoint is being split into two services with identical operation signatures, and the job of the relay service is to identify which of these the client data needs to be sent to, then send it.
So given this, I'm trying to reuse the target interface in my relay wcf service so that the client can connect to my relay with no changes. In testing I get the following error when attempting to invoke the call to the target:
There was an error while trying to serialize parameter processDoc. The InnerException message was 'Type 'InputDoc' with data contract name 'InputDoc:http://schemas.datacontract.org/2004/07/RelayService' is not expected. Consider using a DataContractResolver or add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer.'. Please see InnerException for more details.
I suspect the issue is that I've written a bad interface. My interface contains a data contract for the InputDoc class which inherits from the InputDoc class of the target service. Could someone explain how I would be able to successfully pass this object to the target service please?
My interface:
<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