Hello, I'm trying to consume a WCF webservice using the RPC capabilities of the Protobuf-net. Here's my service contract:
namespace WcfEchoService
{
// NOTE: If you change the interface name "IService1" here, you must also update the reference to "IService1" in Web.config.
[ServiceContract]
public interface IEchoService
{
[OperationContract, ProtoBehavior]
string Echo(string value);
[OperationContract, ProtoBehavior]
string EchoNull();
[OperationContract, ProtoBehavior]
CompositeType[] EchoData(CompositeType[] value);
}
// Use a data contract as illustrated in the sample below to add composite types to service operations.
[DataContract]
[ProtoContract]
public class CompositeType
{
[ProtoMember(1)]
public bool BoolValue
{
get;
set;
}
[ProtoMember(2)]
public string StringValue
{
get;
set;
}
}
}
And just below is my .NET CF client:
class EchoServiceClient : ProtoClient, IEchoService {
#region IEchoService Members
public EchoServiceClient() : base(new HttpBasicTransport("my service URI"))
{
}
public string Echo(string value)
{
return (string)this.Invoke("Echo", value);
}
public string EchoNull()
{
return (string)this.Invoke("EchoNull");
}
public CompositeType[] EchoData(CompositeType[] value)
{
return (CompositeType[])this.Invoke("EchoData", value);
}
#endregion
}
And this is how i try to consume the webservice:
class Program
{
static void Main(string[] args)
{
EchoServiceClient client = new EchoServiceClient();
Console.WriteLine(client.EchoNull());
}
}
I keep getting an exception with the following message:
Either ContentLength must be set to a non-negative number, or SendChunked set to true in order to perform the write operation when AllowWriteStreamBuffering is disabled.
As far as i can tell after digging in protobuf-net's source code the problem seems to be that there is no content-lenght specified. Is there any other way to consume WCF webservices using protobuf-net serialization in .NET CF or a way to solve this issue?
Marc you're on:)