.net - Protobuf-net How to consume a WCF service in NET CF client? -
I am trying to use a WCF webservice using RPB capabilities of Protobuf-net here is my service agreement :
Namespace WcfEchoService {// Note: If you change the interface name "IService1" here, you must also update the reference to "IService1" in Web.config. [ServiceCentrett] Public Interface iEceService {{OperationContract, ProtoBehier} String Echo (string value); [Operation Contract, Protbihair] String Econel (); [Operation Contract, ProtoBehier] Composite type [] Ecodata (composite type [] value); } // To add composite type for operation of the service, use the data contract as illustrated in the sample below. [DataContract] [Protocco contract] Public class composite type {[Protopomember (1)] Public Child Boole Value {Received; Set; } [Protomber (2)] Public string string value {receives; Set; }}}
and just below is my .NET CF client:
Class EcoSerceclient: Protocol, IE service {
# Region IEchoService member public EchoServiceClient (): base (new HttpBasicTransport ("My service URI") {} public string echo (string value) {return (string) this.Invoke ("echo", value); } Public string icon () {return (string) this.Invoke ("EchoNull"); } Public composite type [] Ecodata (composite type [value]) {returns (composite type []) this.Invoke ("EchoData", value); } #endregion}
And I try to consume the webservice like this:
class program {static zero main (string [] args ) {EchoServiceClient Client = New Ecosacclant (); Console.WriteLine (client.EchoNull ()); }}
I am getting an exception with the following message:
ContentLength should either be set to a non-negative number, or the SendChunked set Set to true when permissionWriteStreamBuffering is disabled, then execute the writing methodology.
As far as I can tell that after digging into the source code of Protof-Net, the problem is that there is no specified content-length, to solve this problem, protocol- Is there any other way to consume WCF webservices using Net Serialization?
You are Marker :)
Edit: I forgot the question ; Short version: ProtoClient! = WCF they are not compatible.
The compact framework fears that the WCF stack lacks all the necessary points required for it; In essence, you can not use this approach with WCF + CF.
I know about various activities for Protobf-Net with CF, though;
- Service returns a
byte []
or (better)stream
and handle it manually; No, this is not beautiful, but it works - You can try to include the optional RPC stack with Protobuf-Net;
Optional stack ProtoClient & lt; T & gt; / code>; I honestly can not remember that he works on CF, and I'm not in a position to investigate this time. It will work on should cf, because I remember to compile it ... some examples are used (both for 2.0-style and 3.5-style).
Comments
Post a Comment