Click here to Skip to main content
15,897,371 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
I created a webservice,where it return a long data,when i call web service It does not return any data?when i decress amoung of data in webservice it working correctly.

C#
public byte[] Start(byte[] requestInput)
 {
    hostServer= new HostServer();
    Result= hostServer.ContactToServer(Encoding.UTF8.GetString(requestInput));

    return Encoding.UTF8.GetBytes(Result);
 }
    //with end of execute the webservice does not return data to client



C#
[Serializable()]
    public class HostServer
    {
        public HostServer(TcpClient client)
        {
            Client = client;
        }
        public HostServer()
        {
        }

        private TcpClient Client;

        private HttpWebResponse _WebResponse;
        public HttpWebResponse WebResponse
        {
            get { return _WebResponse; }
        }

public string ContactToServer(string requestinput)
       {
           requestinput=HttpUtility.UrlDecode(requestinput);

           string url = GetRequseUrl(requestinput);

           HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
           HttpWebResponse response = (HttpWebResponse)request.GetResponse();
           
          
           String ver = response.ProtocolVersion.ToString();
           Stream d = response.GetResponseStream();

           StreamReader reader = new StreamReader(d);
           string res = string.Empty;
           try
           {
              res= reader.ReadToEnd();
             
           }
           catch
           {
           }

           reader.Close();
           d.Close();

           return res;

       }

}
Posted
Updated 17-Sep-11 4:23am
v3

1 solution

for long data better create asynchronous callbacks
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900