public void Invoke(HttpSessionState session, DataInputStream input)
 {
     HttpProcessor.GetClient<AskServiceSoapClient>(session).VoteForQuestion(
        input.ReadString(),
        input.ReadString(),
        input.ReadInt32(),
        input.ReadInt32());
 }
 public void Invoke(HttpSessionState session, DataInputStream input)
 {
     _result = HttpProcessor.GetClient<CommentServiceSoapClient>(session).GetCommentIDs(
         input.ReadString(),
         input.ReadString(),
         input.ReadInt32(),
         input.ReadInt32(),
         input.ReadInt32());
 }
 public void Invoke(HttpSessionState session, DataInputStream input)
 {
     _result = HttpProcessor.GetClient<AskServiceSoapClient>(session).SubmitQuestion(
         input.ReadString(),
         input.ReadString(),
         input.ReadString(),
         input.ReadInt32(),
         input.ReadInt32(),
         input.ReadStringArray(),
         input.ReadInt32(),
         input.ReadBoolean());
 }
 public void Invoke(HttpSessionState session, DataInputStream input)
 {
     _result = HttpProcessor.GetClient<PhotoServiceSoapClient>(session).GetPhotosForCollection(
         input.ReadString(),
         input.ReadString(),
         input.ReadInt32());
 }
 public void Invoke(HttpSessionState session, DataInputStream input)
 {
     HttpProcessor.GetClient<AskServiceSoapClient>(session).AttachPhoto(
        input.ReadString(),
        input.ReadString(),
        input.ReadString(),
        input.ReadInt32(),
        Convert.ToBase64String(input.ReadByteArray()));
 }
        private static void ProcessPostRequest(HttpRequest request, HttpResponse response, HttpSessionState session)
        {
            response.ContentType = "application/octet-stream";

            var memoryStream = new MemoryStream();
            var output = new DataOutputStream(memoryStream);

            try
            {
                var input = new DataInputStream(request.InputStream);
                var version = request.Headers["version"];
                if (version != null)
                {
                    if (!HttpProcessor.PROTOCOL_VERSION.Equals(version, StringComparison.Ordinal))
                        throw new IOException(String.Format(
                            CultureInfo.CurrentCulture,
                            Resources.IO_InvalidProtocolVersion,
                            version,
                            HttpProcessor.PROTOCOL_VERSION));
                }

                if (input.ReadInt16() == HttpProcessor.INVOCATION_CODE)
                    InvokeMethod(session, input.ReadInt32(), input, output);
                input.Close();
            }
            catch (Exception e)
            {
                if (output == null)
                    output = new DataOutputStream(response.OutputStream);

                output.WriteInt16(HttpProcessor.RESULT_EXCEPTION);
                Debug.WriteLine(e.StackTrace);
                output.WriteString(e.ToString());
            }

            response.SetContentLength(memoryStream.Length);

            try
            {  
                var data = new Byte[memoryStream.Length];
                memoryStream.Seek(0, SeekOrigin.Begin);
                memoryStream.Read(data, 0, data.Length);
                response.OutputStream.Write(data, 0, data.Length);
            }
            finally
            {
                if (output != null)
                    output.Close();
                response.OutputStream.Close();
            }
        }