0

I am working on a project where it involves calling a WCF web service to upload content of a given file to a WCF web service. client is a iPad application written using Titanium Studio. But i am allowed to send files which are less than 8KB in size. but files i am sending can be large in size than 8KB. when i send files which are larger than 8KB, web service return following error message.

The server encountered an error processing the request

Given below is the client code which call

Data is sent to the web service using JSON format.

        var readFile = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,'log.txt');

        modifiedDate = readFile.modificationTimestamp();
        var payload ={dateTime: modifiedDate, fileName:'log.txt' , text:readFile};


    var xhrLog = Titanium.Network.createHTTPClient();
    var serviceUrl = 'http://192.168.134.134/webservice/viewerservice.svc/submitLogData/';

    xhrLog.open("POST", serviceUrl);
    xhrLog.setRequestHeader("Content-Type", "");
    xhrLog.setRequestHeader("Authentication-Token", "605b32dd");    
    xhrLog.onload = function() {
        Ti.API.info(this.responseText);
    },
    xhrLog.onerror = function() {

    }
    xhrLog.send(JSON.stringify(sendData));

Following is the service contract and data contract used in the WCF web service to retrive data.

[OperationContract]
        [WebInvoke(
            RequestFormat = WebMessageFormat.Json,
            ResponseFormat = WebMessageFormat.Json,
            BodyStyle = WebMessageBodyStyle.Bare,
            UriTemplate = "/SubmitLogData/")]
        bool SubmitLogData(List<LogData> log);

Data Contract

[DataContract]
    public class LogData
    {
        [DataMember]
        public string dateTime { get; set; }

        [DataMember]
        public string fileName { get; set; }

        [DataMember]
        public string text { get; set; }
    }
KItis
  • 5,476
  • 19
  • 64
  • 112

1 Answers1

0

You probably need to increase all the quotas - example of messagesize - would be helpfull if you could enable the WCF server-side tracing and see the exact error message!

UPDATE: example for a wsHttpBinding:

<binding name="wsHttp" maxReceivedMessageSize="2147483647">
  <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
    maxArrayLength="2147483647" maxBytesPerRead="2147483647"
    maxNameTableCharCount="2147483647" >
</binding>
Community
  • 1
  • 1
Leon
  • 4,532
  • 1
  • 19
  • 24