I ame executing methods on a different computer via a WCF service here is a little example of my code:
the call to the method:
return pipeProxy.SystemRequest(InstanceName, MethodName, Parameters);
These are the method and interface:
[ServiceContract]
public interface IBlissRequest
{
[OperationContract]
object SystemRequest(string InstanceName, string MethodName, object[] Parameters);
}
public class BlissRequest : IBlissRequest
{
public object SystemRequest(string InstanceName, string MethodName, object[] Parameters)
{
return System21.BlissProcessingUnit.BPU.RequestFromIBC(InstanceName, MethodName, Parameters); ;
}
}
as you can see i send 2 strings, and an array of objects, and i get an object back, this method is called by different locations and the objects can be diferent, if i send strings or integers through this method everything works fine, but when i try to send a List things go bad, and the method can not execute. now ive read that standard the DataContractSerializer
is used and that i need to convert it to XmlSerializer
to get it to work. ive found http://msdn.microsoft.com/en-us/library/ms733901.aspx but i can not get my example to work. could somone please point me in the good direction.
This is the exception that is thrown:
There was an error while trying to serialize parameter http://tempuri.org/:Parameters. The InnerException message was 'Type 'System.Collections.Generic.List`1[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' with data contract name 'ArrayOfstring:http://schemas.microsoft.com/2003/10/Serialization/Arrays' 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.
The inner exception:
{"Type 'System.Collections.Generic.List`1[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' with data contract name 'ArrayOfstring:http://schemas.microsoft.com/2003/10/Serialization/Arrays' 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."}
the object that need to be send are: if it is possible everything, if not just all the normal c# things like Lists