Timeout using HttpUrlConnection

Dear all,
today I found out that my software has a problem with the standard timeout using the HttpUrlConnection. I have to connect to a server and have to read a file with more than 1400 Byte. After 1460 Byte it seems that the connection is closed. I downloaded some pieces of code (http://groups.google.de/groups?hl=de&lr=&selm=b7aab076.0401230914.6c2c678f%40posting.google.com&rnum=1) and added it to my software (creating new TimeoutHandler, ...). But I still get this timeout - or it seems like it is a timeout.
Any ideas??
Thx,
Sabine

today I found out that my software has a problem with
the standard timeout using the HttpUrlConnection.What timeout? I don't believe there is one with this class. Maybe the server side is closing the connection - and if that's the case, it's not going to matter what you do on the client end.

Similar Messages

  • Problem using HttpURLConnection

    Hi
    I am using HttpURLConnection,to download the contents from the URL,in my application.
    When only a limitted no of threads are started then it is working fine and the stuffs are getting downloaded into a file as per my requirement However if if sponning a large number of thread or if the http server is slow then
    instead of downloading the contents slowly...the inputsteam is showing eof and the downloading is completed without actual completino.Hence i am failing to dowload all the contents{color:#008000}.(The application requires to start around 100 threads and download the contents of all the urls into a single file){color}
    Following code has been used :
    {color:#3366ff}+url = new URL(httpUrl);+
    conn = (HttpURLConnection) url.openConnection();
    conn.setRequestMethod("GET");
    conn.setAllowUserInteraction(false);
    conn.setDoInput(true);
    conn.setDoOutput(true);
    conn.setUseCaches(false);
    conn.connect();
    appendToTempFile("");
    appendToTempFile("");
    appendToTempFile("Downloading " httpUrl);+
    in = conn.getInputStream();
    BufferedReader reader =BufferedReader(new InputStreamReader(in));
    String text;
    +while ((text = reader.readLine()) != null) {+
    if (!text.startsWith(" "))
    appendToTempFile(text);
    +}+
    +}+
    conn.disconnect();
    *{color:#000000}Please suggest me some solution.{color}*
    {color}

    1.
    Are you writing to the file with all threads at the same time? Then this could be a problem. My approach would be a consumer/producer pattern, where the download threads are the producers. They download the data and store it at a central place. Another thread, the consumer, fetches the data from this central place and writes it the file. This way you only have one thread, which is working with the file and you don't get problems like one thread is overwriting the data of another thread.
    2.
    If you start many download threads, there yould be limitations, which could result in timeouts or something like that. Some servers only allow a defined number of connections from one IP. Same goes for your browser. Firefox for example can be configured to open only a specified number of connections to one server. There are some os settings, which could be limitating, too. So you should try to not use too many threads. You could use a thread pool, for example.

  • Configuring a timeout in HttpURLConnection

              Greetings,
              I am using HttpURLConnection class to do posts and then reading the response
              by opening an InputStream on the same connection.
              Is there some way of putting in a Timeout, such that, if I dont receive any response
              within that period, i cd disconnect or return.
              Thanks in advance...
              Regards
              Vinay S
              

    Hi,
              No, you should be good to go. The HttpURLConnection.setTimeout(int) is all you need to
              call. It does essentially what the code at the url you sent me does. It sets the timeout
              value on the socket. You can drop the classes from logicamente.
              Bill
              Vinay S wrote:
              > Hey William,
              >
              > I am using wls 6.1sp2. Now, if i obtain the patch from support, would i still
              > need to use the classes from
              > http://www.logicamente.com/sockets.html, or there is a new way, using weblogic
              > patch?
              >
              > Regards
              > Vinay
              >
              > William Kemp <[email protected]> wrote:
              > >Hi,
              > >
              > >This feature was added in 6.1, but needs a patch to work correctly. The
              > >change request
              > >is CR055987 and has a patch for 6.1sp2. If I remember correctly, when
              > >the connection
              > >times out, an exception is thrown so that you can recover accordingly.
              > >Support can give
              > >you the patch.
              > >
              > >As an aside, I find it amazing that this was never an option to HttpURLConnection
              > >until
              > >1.4. We just added it because it seemed obvious. Maybe not to everybody.
              > >;-)
              > >
              > >Bill
              > >
              > >Vinay S wrote:
              > >
              > >> Thanks Dimitri.
              > >>
              > >> I am using and Sun JDK 1.3.1 (wls 6.1) and i tried the first option.
              > >There seems
              > >> to be a problem.
              > >> If the connection times out, no exception is thrown, it just waits
              > >there, it doesnt
              > >> even exit. Is there any workaround for this? I need to take some actions
              > >if the
              > >> connection timesout, but there seems to be no intimation.
              > >>
              > >> any suggetions?
              > >>
              > >> Regards
              > >> Vinay
              > >>
              > >> "Dimitri I. Rakitine" <[email protected]> wrote:
              > >> >For some strange reason this feature was not supported until 1.4.
              > >> >
              > >> >If you use Sun's JDK, this hack works:
              > >> >
              > >> >http://www.logicamente.com/sockets.html
              > >> >
              > >> >(or you can use a different HTTP client - http://www.innovation.ch/java/HTTPClient/
              > >> >for example).
              > >> >
              > >> >Vinay S <[email protected]> wrote:
              > >> >
              > >> >> Greetings,
              > >> >
              > >> >> I am using HttpURLConnection class to do posts and then reading
              > >the
              > >> >response
              > >> >> by opening an InputStream on the same connection.
              > >> >> Is there some way of putting in a Timeout, such that, if I dont
              > >receive
              > >> >any response
              > >> >> within that period, i cd disconnect or return.
              > >> >
              > >> >> Thanks in advance...
              > >> >
              > >> >> Regards
              > >> >> Vinay S
              > >> >
              > >> >--
              > >> >Dimitri
              > >
              

  • How do you *unset*  Content-Type when using HttpURLConnection ?

    Hi people,
    I am using HttpURLConnection to set some http headers. It all works fine except that this utility is setting Content-type to text/html even though I cam not coding it to do so. I can overwrite Content-type by setting it to say, a blank, explicitly in the code, but Content-type still appears as a header (eg if I view the headers in a proxy.)
    My question is - how do you completely unset Content-Type? Here's the code snippet :
    URL url = new URL("http://mymachine-uk.uk.company.com:24331/test.html");
    HttpURLConnection con = (HttpURLConnection) url.openConnection();
    con.setIfModifiedSince(longdate); // I've set up longdate previously
    // set some headers
    con.setRequestProperty("Cache-Control","max-age=0");
    con.setRequestProperty("User-Agent","Mozilla/5.0");
    con.setRequestProperty("Keep-Alive","300");
    // I've tried hacking it like this :
    // con.setRequestProperty("Content-type",null);
    // but that just shows an empty Content-type, rather than get rid of it.
    // In a proxy window on port 24331, the three headers set explicitly above
    // all show up correctly. But Content-type:text/html is also shown, even though not coded.
    // If I fire off the same page request from a browser, Content-type ISN'T set.
    // so there must be a way of doing it :-) Help!
    thanks.
    Edited by: colin_the_aardvark on Feb 24, 2010 1:45 AM

    Hi there,
    thanks very much for trying this, the background to this is as follows :
    I am testing a software server caching product which is giving me weird behaviour; the actions the cache performs are supposed to be based on the various http headers. I am using a debug proxy ("Charles") (limited freeware-for-a-short-period) to see exactly what http headers are being set by the calling browser, or in this case, the java program. I am setting the headers directly in the code above to match what my browser is setting, as revealed by Charles. Trouble is, I'm getting different reponses back: The browser gets a http 304 from the cache and my java program gets a 200, so I have obviously failed to emulate the browser.. and the only difference I can see is that the Conetnt-Type is not set when I call the page from internet explorer, but with my program above, Content-Type is set, to a default of text/html. I want to get rid of it so I have copied the browser http header settings 100%.
    - I tried compiling this code and running it from the prompt (outside of development environment) and Content-Type is still showing up. So from what you are saying... if your attempt does not set this.. then it looks like Content-type must be getting set via some other means?
    thankyou :-)

  • Chinese character using HttpURLConnection

    Hi,
    I am trying to retrieve a chinese page using HttpURLConnection and as a result getting all chinese characters as ???.
    I know it has to be something with the fonts but cannot figure out exactly what. Any help in this regard will be great.
    Below is my sample code...
    URL connect = new URL("http://chinese.site.url");
    HttpURLConnection connect = (HttpURLConnection) connect.openConnection();
    connect.setRequestProperty("content-type", "text/html;charset=gb2312");
    BufferedReader in = new BufferedReader(new InputStreamReader(connect.getInputStream()));
    String inputLine;
    while ( (inputLine = in.readLine()) != null) {
    System.out.println(inputLine);
    }

    Hi,
    I am trying to retrieve a chinese page using
    HttpURLConnection and as a result getting all chinese
    characters as ???.
    I know it has to be something with the fonts but
    cannot figure out exactly what. Any help in this
    regard will be great.
    Below is my sample code...
    URL connect = new URL("http://chinese.site.url");
    HttpURLConnection connect = (HttpURLConnection)
    connect.openConnection();
    connect.setRequestProperty("content-type",
    "text/html;charset=gb2312");
    BufferedReader in = new BufferedReader(new
    InputStreamReader(connect.getInputStream()));
    String inputLine;
    while ( (inputLine = in.readLine()) != null) {
    System.out.println(inputLine);
    }u forgot to set the encoding for the inputstreamreader.
         public static String readTextFiles (String filename)     {
              String data="";
              File file = new File(filename);
              char[] chars = new char[(int) file.length()];
              try {
                   FileInputStream readingfile = new FileInputStream(file);
                   BufferedReader in = new BufferedReader(new InputStreamReader(readingfile, "gb2312"));
                   in.read(chars);          // org
                   in.close();
              } catch (FileNotFoundException e) {
                    System.out.println("File Not Found " + e.getMessage());
              } catch (IOException e) {
                    System.out.println("IO exce " + e.getMessage());
              data = new String(chars);
              return data;
         }     // end readTextFile

  • Using HttpUrlConnection

    Hi ,
    I'm facing problem in Using HttpUrlConnection. When I submit a request to sun java web server 1.6 . By using the following code I request the server , The server receives the request but can not read the request body that is written on the connection output stream.
    my client code :
    URL page = new URL(url);
    HttpURLConnection sock = (HttpURLConnection) page.openConnection();
    sock.setRequestMethod("POST");
    sock.setRequestProperty("Content-Length",
    "" + Integer.toString(body.getBytes().length));
    sock.setUseCaches(false);
    sock.setDoOutput(true);
    if (body.length() > 0) {
    DataOutputStream out = new DataOutputStream(sock.getOutputStream());
    out.writeBytes(body);
    out.flush();
    out.close();
    sock.connect();
    BufferedReader in = new BufferedReader (new InputStreamReader(sock.getInputStream(),"Cp1256"));
    int nHttpResponseCode = sock.getResponseCode();
    if(nHttpResponseCode != HttpURLConnection.HTTP_OK){
    System.out.println("\tHttp error:" + nHttpResponseCode );
    in.close();
    return nHttpResponseCode;
    //receive reply
    in.close();
    return nHttpResponseCode;
    My server code is :
    String params = null;
    try {
    java.io.InputStream in = request.getInputStream();
    byte b[] = new byte[1000]; //in.available()];
    in.read(b);
    char[] s = new char[b.length];
    for (int i = 0; i < b.length; i++) {
    if (b[i] == 0)break;
    s= (char) b[i];
    params = new String(s);
    catch (Exception exp) {
    exp.printStackTrace();
    I tried to submit the request after appending the request body to the url (url like that http://ipadd/webapp/page.jsp?appndedVlaues) and retreived the appended string by calling getQueryString method and It worked well.
    Does anybody faced such a problem before?
    please help
    Thanks

    I have done things like this several times with the URLConnection class and it always seem to work. I do not, however, call the
    sock.connect();
    method. My code seems to work fine without it. First I get the OutputStream and write to it. Then I get the InputStream and read the data from it.
    Does the "body" variable in the client code contain any data at all? I don't see it initialized anywhere with data.
    I have recently developed a file upload component. It's open source, Apache License and available from our website, www . jenkov . com. It works fine, and that too reads data from the request.getInputStream(). Perhaps you can look at that code and see if you can steal some bits that can make your server code work?

  • Unable to access URL using HttpURLConnection

    Hi,
    I am using HttpURLCOnnection class to post a data to a url(which is a web service). The webservice accepts data as text/xml.
    Following is the code snippet i used:
    URL url = new URL("http://xxx.xxx.xx.xx:8080/SampleWebService.svc");
    HttpURLConnection conn =(HttpURLConnection) url.openConnection();
    conn.setDoOutput(true);
    conn.setRequestMethod("POST");
    conn.setRequestProperty("Content-Type","text/xml");
    String urlStr="param1="+URLEncoder.encode(value1)+"&param2="+URLEncoder.encode(value2)
    OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
    wr.write(urlStr);
    wr.flush();
    InputStream in2 = conn.getInputStream();
    in2.close();
    wr.close();
    But when i execute the code, I am getting following error at the line(InputStream in2 = conn.getInputStream();)
    java.io.IOException: Server returned HTTP response code: 400 for URL
    Can someone please suggest a solution. Am i missing something here?
    Thanks in advance

    This may not be the cause of the problem, however I will point out that the Content-Type you are setting (text/xml) is not the content type you are sending (key=value&key=value...).
    If the webservice only accepts text/xml, then this is probably the cause of your problem.
    Another thing you could try is removing the line that sets the content type.
    Here are the request properties in some (hacky) code that I have used for sending POST requests:
                   conn.setDoOutput(true);
                   conn.setRequestProperty("Host", url.getHost());
                   conn.setRequestProperty("Referer", referer);
                   conn.setRequestProperty("Cache-Control", "max-age=0");
                   conn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727)");
                   conn.setRequestProperty("Cookie", cookies);Edited by: 842408 on Mar 7, 2011 10:14 AM
    Edited by: 842408 on Mar 7, 2011 10:14 AM

  • Log into Wordpress using HttpURLConnection is possible ?

    Hello, i wonder if logging into my wordpress admin account is possible using HttpUrlConnection.
    I tried to do so, but wordpress returns error:"Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress".
    I used cookie manager and handler to enable my cookies, but seems not to work. Thank you for your help !
    CookieManager cm = new java.net.CookieManager();
            CookieHandler.setDefault(cm);

    Only if you have tacacs in between,
    http://www.cisco.com/univercd/cc/td/doc/product/vpn/vpn3000/4_7/admon/access.htm#wp1507954
    Pls rate if that helps
    Regards,
    ~JG

  • How to receive 100 Continue responses using HttpURLConnection

    Hi there,
    My server returns:
    HTTP/1.1 100 Continue
    Set-Cookie: Cookie1=Value1
    Server: Microsoft-IIS/5.0
    Date: Mon, 29 Sep 2000 18:34:02 GMT
    HTTP/1.0 200 OK
    Server: Server 2
    Set-Cookie: Cookie2=Value2
    Content-Type: text/html
    I'm using HttpURLConnection to get the response.
    I need to get both responses, however HttpURLConnection only returns the 200 OK response.
    How do I get the 100 Continue response using this class? I need it to retrieve the cookie.
    Thanks.

    You can't. If you check the j2se source code you will notice that sun.net.www.http.HttpClient just drops the '100 Continue' and waits for the actual response that follows.

  • We are getting LDAP response read timed out, timeout used:15000ms oid ovd

    Hi All,
    We are having this in prod environment
    We are getting a lot of these:
    2012-09-12 14:43:52,097 [[ACTIVE] ExecuteThread: '7' for queue: 'weblogic.kernel.Default (self-tuning)'] ERROR NamingException: [LDAP: error code 1 - LDAP Error 1 : LDAP response read timed out, timeout used:15000ms.]
    2012-09-12 14:44:24,720 [[ACTIVE] ExecuteThread: '7' for queue: 'weblogic.kernel.Default (self-tuning)'] ERROR NamingException: [LDAP: error code 1 - LDAP Error 1 : LDAP response read timed out, timeout used:15000ms.]
    2012-09-12 15:09:57,206 [[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'] ERROR NamingException: [LDAP: error code 1 - LDAP Error 1 : LDAP response read timed out, timeout used:15000ms.]
    2012-09-12 15:25:12,029 [[ACTIVE] ExecuteThread: '23' for queue: 'weblogic.kernel.Default (self-tuning)'] ERROR NamingException: [LDAP: error code 1 - LDAP Error 1 : LDAP response read timed out, timeout used:15000ms.]
    OID/OVD is apparently not doing well!
    Regards,
    PraveenSharma

    Hi,
    OID log:
    [2012-09-12T11:27:24+02:00] [OID] [NOTIFICATION:16] [] [OIDLDAPD] [host: br2lfauth2p.intern.uc.se] [pid: 26857] [tid: 8] [ecid: 004mNrBiy2p9Pdw6wFnZ6G0006Zd007WLb,0] ServerWorker (REG):[[
    BEGIN
    ConnID:1076930 mesgID:915 OpID:914 OpName:modrdn ConnIP:::ffff:172.30.18.198 ConnDN:cn=oam,ou=ucsystemaccounts,dc=uc,dc=se
    [gsldmda_ModifyDN]:ORA-60 ORA-00060: deadlock detected while waiting for resource
    ORA-06512: at line 1
    encountered
    END
    Regards,
    PraveenSharma

  • How to use HttpURLConnection

    hi! i'd like to know how to HttpURLConnection. it is an abstract class so i cannot instantiate it direcly. where is the factory to create such a damn object???
    by the way...can i use HttpURLConnection to get response from an PHP script? do i have to do the same steps as getting an html document or is it handled different?

    To make an HttpURLConnection you need to instantiate a URL object and use openConnection() which returns a URLConnection object, now if the URL use the http or https protocol you can cast it as an HttpURLConnection. Here's some sample code:
    java.net.URL address = new java.net.URL("http://www.yahoo.com");
    java.net.HttpURLConnectionYahooConn = address.openConnection();You'll need to handle java.net.MalformedURLException when you use new URL(String address)
    Cheers

  • Download PDF using httpURLConnection

    Can anyone help me on downloading PDF (or any file other than HTML) using httpURLConnection class. Reading the input stream line by line from the site using Strings causes a corrupt file download.
    Please help !!! Thanks.

    you cannot read it line by line. try reading it byte by byte
         URL url = new URL("http://yourserver.com/yourfile.pdf");
         HttpURLConnection conn = (HttpURLConnection)url.openConnection();
         InputStream in = conn.getInputStream();
         ByteArrayOutputStream bos = new ByteArrayOutputStream();
         int i;
         while((i = in.read())!= -1)
              bos.write(i);
         byte [] b = bos.toByteArray();
         FileOutputStream fos = new FileOutputStream("c:\\temp\\test.pdf");
         fos.write(b);
         fos.close();
         conn.disconnect();

  • SSL timeout with HttpURLConnection

    I'm using an HttpURLConnection to connect to a URL (in my case, an https URL). The readtimeout on the HttpURLConnection has not been set, so it's the default of no timeout. The HttpURLConnection is able to connect immediately, but getting a response back can take some time (the URL points to a servlet that does some work that can take a little while). When it's less than 10 minutes, this works fine. When it takes more than 10 minutes, HttpURLConnection.getContentType() throws a SocketException:
    java.net.SocketException: Connection reset
    at java.net.SocketInputStream.read(SocketInputStream.java:168)
    at com.sun.net.ssl.internal.ssl.InputRecord.readFully(InputRecord.java:284)
    at com.sun.net.ssl.internal.ssl.InputRecord.read(InputRecord.java:319)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:720)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:677)
    at com.sun.net.ssl.internal.ssl.AppInputStream.read(AppInputStream.java:75)
    at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
    at java.io.BufferedInputStream.read1(BufferedInputStream.java:256)
    at java.io.BufferedInputStream.read(BufferedInputStream.java:313)
    at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:606)
    at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:554)
    at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:571)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:928)
    at sun.net.www.protocol.http.HttpURLConnection.getHeaderField(HttpURLConnection.java:1850)
    at java.net.URLConnection.getContentType(URLConnection.java:479)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getContentType(HttpsURLConnectionImpl.java:382)
    It appears that there is some sort of underlying SSL-related timeout that, in this case, is set to 10 minutes. Does anyone know what might be causing this and how I can change it programmatically?
    Thanks,
    vlb514

    The server is resetting the connection.

  • Can't fully download long web-pages using HttpURLConnection

    I'm using these two methods:
    /**keeps document encoding or sets Cp1251 as default
          * @param uri is uri to document
          * @return {@link InputStreamReader} with encoding
         public static InputStreamReader getInputStreamReader(String uri) throws IOException{
              URL url = new URL(uri);
              HttpURLConnection urlConn = (HttpURLConnection)url.openConnection();
              urlConn.setConnectTimeout(timeout);
              urlConn.setDefaultUseCaches( false );
            urlConn.setUseCaches( false );
            urlConn.setRequestProperty( "Cache-Control", "max-age=0,no-cache" );
            urlConn.setRequestProperty( "Pragma", "no-cache" );
            String encoding = urlConn.getContentEncoding();
            if(encoding == null || encoding.equals("") ){
                 String Content_Type = urlConn.getHeaderField("Content-Type");
                 if(Content_Type.contains("charset=")){
                     String[] t = Content_Type.split("charset=");
                     if(t != null && t.length>0){
                          encoding = t[t.length-1];
            if(encoding == null || encoding.equals("")){
                 encoding = "windows-1251";
            InputStreamReader isr = new InputStreamReader(urlConn.getInputStream(), encoding);
            return isr;
         /**Returns content in default charset
          * @param uri is uri to document you want to get
          * @return String with encoding equal to {@link Charset.defaultCharset()}
         public static String fetchEncodedURI(String uri) throws IOException{
              InputStreamReader isr = getInputStreamReader(uri);
              ByteArrayOutputStream baos = new ByteArrayOutputStream();
              OutputStreamWriter osw = new OutputStreamWriter( baos, Charset.defaultCharset());
              char[] buffer = new char[256];
              int n = -1;
              while ( (n = isr.read(buffer))!= -1 ){
                   osw.write(buffer, 0, n);
            String outputString = new String(baos.toByteArray());
            osw.flush();
            osw.close();
            baos.flush();
            baos.close();
            return outputString;
         }The problem is that some pages are cut! I make output of result string (outputString) ans see for example just 2/3 of the real page content.
    Is it possible to overcome this difficulty?
    Edited by: Holod on 01.10.2008 11:31

    ejp wrote:
    Personally, I'd suggest reading the whole page as bytes into baos and covert to string with one call to boas.toString(encoding)Or use a StringWriter. The way you're doing it is the worst of both worlds.Can you help me please with a sample link?
    Or please tell, is it right solution?
             /**Returns content in default charset
          * @param uri is uri to document you want to get
          * @return String with encoding equal to {@link Charset.defaultCharset()}
         public static String fetchEncodedURI(String uri) throws IOException{
              InputStreamReader isr = getInputStreamReader(uri);
              ByteArrayOutputStream baos = new ByteArrayOutputStream();
              //OutputStreamWriter osw = new OutputStreamWriter( baos, Charset.defaultCharset());
              StringWriter sw = new StringWriter();
              char[] buffer = new char[256];
              int n = -1;
              int previousPosititon = 0;
              while ( (n = isr.read(buffer))!= -1 ){
                   sw.write(buffer,previousPosititon,n);
                   previousPosititon+=n;
                   //osw.write(buffer, 0, n);
            //osw.flush();
         //String outputString = new String(baos.toByteArray());
            String outputString = sw.toString();
            //osw.close();
            baos.flush();
            baos.close();
            return outputString;
         }Edited by: Holod on 03.10.2008 5:41

  • SQL Server 2008 R2 - Report Builder 3.0 - timeout using shared data source and stored procedure

    I select the shared datasource from the data source propeties dialog, test the connection and everything is good.
    I add a dataset by selecting "use a dataset embedded in my report" option within the Dataset properties dialog.
    I select the newly added data source, click the "Stored procedure" query type and drop down the list box and select my intended stored procedure.
    the timeout for the dataset is "0" seconds.
    I click the "OK" button and I'm presented with the parameters to the stored procedure.
    I enter valid data for the parameters and click the "OK" button.
    I then get the following error message after 30 seconds:
    The problem is, all of the timeouts, that I'm aware of, have values of zero (no timeout) or high enough values that 30 seconds isn't even close to the timeout.
    I think the smallest timeout we have is 120 seconds.
    I have searched this site and many others and the solutions all involve altering the stored procedure to get the fields into report builder and then revert the stored procedure back to its original form.
    To me, this is NOT a solution.  
    I have too many stored procedures that need to be brought into Report Builder.
    I need a real solution.
    Thank you for you time, Tim Caldwell.
    Timothy E Caldwell

    I don't mean to be rude, but really, check to see if the stored procedure can return data rows???
    Maybe I'm not being clear enough.
    The stored procedure runs perfectly fine.
    it runs perfectly fine in the production environment and the test environment.
    I can access the stored procedure in several ways and have it return correct data.
    I can even trick report builder into creating a dataset with parameters and run the stored procedure that way.
    What I cannot do, is to get report builder to not timeout after 30 seconds on the initial creation of a dataset with a Query type of stored procedure.
    I have seen this issues posted again and again and again on may different sites and the "solution" is to simplifiy the stored procedure by creating a stored procedure that has a create table and a select in the stored procedure and that's it.  After
    report builder creates the dataset the developer then has to replace the simplified stored procedure with the actual stored procedure and everything works fine after that.
    HOWEVER, having to go through this process for 70 or more stored procedures is ridiculous.
    It would appear that there is something within report builder itself that is causing this issue.
    The SQL Script included is an example of a stored procedure that will not create fields create a dataset with fields and parameters in Report Builder 3.0:
    USE [CRUM_IT]
    GO
    /****** Object: StoredProcedure [dbo].[COGNOS_Level5ScriptSP] Script Date: 11/17/2014 08:02:26 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    ALTER procedure [dbo].[COGNOS_Level5ScriptSP]
    @CompanyCode varchar(8) = null,
    @GetSiblings varchar(1) = 'N'
    as
    Begin
    -- get emergency contact info
    select *
    into #tmp_Contacts
    from
    (select
    ConEEID,
    con.connamelast as [Emer Contact Last Name],
    con.connamefirst as [Emer Contact First Name],
    con.connamemiddle as [Emer Contact Middle Initial/Name]--,
    ,ROW_NUMBER() over (Partition by ConEEID order by ConNameLast)as rn
    ,ISNULL(
    case when con.conphonepreferred = 'H'
    then '(' + substring(con.conphonehomenumber, 1, 3) + ')' + substring(con.conphonehomenumber, 4, 3) + '-' + substring(con.conphonehomenumber, 7, 4)
    else '(' + substring(con.conphoneothernumber , 1, 3) + ')' + substring(con.conphoneothernumber , 4, 3) + '-' + substring(con.conphoneothernumber , 7, 4)
    end,
    ) as [Emergency Phone]
    from [ultiprosqlprod1].[ultipro_crum].dbo.Contacts con
    where con.ConIsEmergencyContact='y'
    and con.ConIsActive='y'
    ) A
    where A.rn = 1
    CREATE TABLE #tmp_CompanyCodes (CompanyCode varchar(8))
    If @GetSiblings = 'Y'
    Begin
    INSERT INTO #tmp_CompanyCodes (CompanyCode)
    EXEC [z_GetClientNumbers_For_ParentOrg_By_ClientNumber] @CompanyCode
    End
    INSERT INTO #tmp_CompanyCodes
    values (@CompanyCode)
    select *
    into #tmp_Company
    from [ultiprosqlprod1].[ultipro_crum].dbo.Company
    where cmpcompanycode in (select CompanyCode from #tmp_CompanyCodes)
    select distinct
    cmpcompanycode as [Client ID],
    CmpCompanyDBAName as [Client Name],
    eec.eecEmplStatus AS [Employment Status],
    eec.eecEmpNo AS [Employee Num],
    rtrim(eep.eepNameLast) AS [Last Name],
    rtrim(eep.eepNameFirst) AS [First Name],
    isnull(rtrim(ltrim(eep.eepNameMiddle)), '') AS [Middle Initial/Name],
    rtrim(eep.eepAddressLine1) AS [Address Line 1],
    isnull(rtrim(eep.eepAddressLine2), '') AS [Address Line 2],
    eep.eepAddressCity AS [City],
    eep.eepAddressState AS [State],
    CASE
    WHEN len(eep.eepAddressZipCode) > 5 and charindex(eep.eepAddressZipCode, '-', 1) = 0
    THEN substring(eep.eepAddressZipCode, 1, 5)
    ELSE rtrim(eep.eepAddressZipCode)
    END AS [Zip code],
    CASE
    WHEN len(eep.eepAddressZipCode) > 5 and charindex(eep.eepAddressZipCode, '-', 1) = 0
    THEN substring(eep.eepAddressZipCode, 6, 4)
    WHEN len(eep.eepAddressZipCode) > 5 and charindex(eep.eepAddressZipCode, '-', 1) > 0
    THEN substring(eep.eepAddressZipCode, charindex(eep.eepAddressZipCode, '-', 1) + 1, 4)
    WHEN len(eep.eepAddressZipCode) <= 5
    THEN ''
    END AS [ZIP + 4],
    substring(eep.eepSSN, 1, 3) + '-' + substring(eep.eepSSN, 4, 2) + '-' + substring(eep.eepSSN, 6, 4) AS [SSN],
    isnull(convert(VARCHAR(10), eep.eepDateOfBirth, 101), '') AS [Date Of Birth],
    eetFED.TAXCODE AS [FED Tax Code],
    eetFED.FILINGSTATUS AS [Fed Filing Status],
    eetFED.EXEMPTIONS AS [Fed Exemption Allowance],
    eetFED.ADDITIONAL AS [Additional Fed Withholding],
    eetSIT.TAXCODE AS [SIT Tax Code],
    eetSIT.FILINGSTATUS AS [State Filing Status],
    eetSIT.EXEMPTIONS AS [State Exemption Allowance],
    eetSIT.ADDITIONAL AS [Additional State Withholding],
    isnull('(' + substring(eep.eepPhoneHomeNumber, 1, 3) + ')' + substring(eep.eepPhoneHomeNumber, 4, 3) + '-' + substring(eep.eepPhoneHomeNumber, 7, 4), '') AS [Home Phone],
    isnull((SELECT cod.codDesc
    FROM [ultiprosqlprod1].[ultipro_crum].dbo.Codes cod WITH (NOLOCK)
    WHERE cod.codCode = eep.eepEthnicID
    AND cod.codDosTable = 'ETHNICCODE'), '') AS [Race-Origin], --eep.eepEthnicID AS [Race-Origin],
    eep.eepGender AS [Gender],
    isnull(convert(VARCHAR(10), eec.eecDateOfOriginalHire, 101), '') AS [Original Hire Date],
    isnull(convert(VARCHAR(10), eec.eecDateOfSeniority, 101), '') AS [Seniority Date],
    isnull(convert(VARCHAR(10), eec.eecDateOfTermination, 101), '') AS [Termination Date],
    isnull(eecTermType,'') as [Termination Type],
    isnull(TchDesc, '') as [Termination Reason],
    rtrim(eec.eecJobCode) AS [WC Code],
    isnull(eec.eecJobTitle, '') AS [Job Title],
    pgr.pgrPayFrequency AS [Pay Frequency],
    eec.eecFullTimeOrPartTime AS [Full/Part Time],
    eec.eecSalaryOrHourly AS [Pay Type],
    isnull(convert(MONEY, eec.eecHourlyPayRate), 0.00) AS [Hourly Rate],
    isnull(eec.eecAnnSalary, 0.00) AS [Annual Salary],
    [YTD Hours],
    isnull(eep.eepNameFormer, '') AS [Maiden Name],
    eec.eecLocation AS [Location ID],
    rtrim(eec.eecOrgLvl1) AS [Department ID],
    eec.eecorglvl2 AS [Cost Item],
    eec.eecorglvl3 as [Client Project],
    eec.eecPayGroup as [Pay Group],
    isnull(eepAddressEMail,' ') as [Email Address],
    isNull(BankName1,' ') as PrimaryBank,
    isNull(BankRoute1,' ') as PrimaryRouteNum,
    isNull(Account1,' ') as PrimaryAccount,
    isNull(AcctType1,' ') as PrimaryAcctType,
    isNull(DepositRule1,' ') as PrimaryDepositRule,
    isNull(BankName2,' ') as SecondaryBank,
    isNull(BankRoute2,' ') as SecondaryRouteNum,
    isNull(Account2,' ') as SecondaryAccount,
    isNull(AcctType2,' ') as SecondaryAcctType,
    isNull(DepositRule2,' ') as SecondaryDepositRule,
    isNull(
    CASE
    WHEN DepositRule2 = 'D'
    THEN '$' + convert(varchar, cast(EddAmtOrPct2 AS decimal(10,2)))
    WHEN DepositRule2 = 'P'
    THEN convert(varchar, cast((EddAmtOrPct2*100) AS decimal(10,0))) + '%'
    ELSE null
    END,' ') as SecondaryDepositAmount,
    isNull(BankName3,' ') as ThirdBank,
    isNull(BankRoute3,' ') as ThirdRouteNum,
    isNull(Account3,' ') as ThirdAccount,
    isNull(AcctType3,' ') as ThirdAcctType,
    isNull(DepositRule3,' ') as ThirdDepositRule,
    isNull(
    CASE
    WHEN DepositRule3 = 'D'
    THEN '$' + convert(varchar, cast(EddAmtOrPct3 AS decimal(10,2)))
    WHEN DepositRule3 = 'P'
    THEN convert(varchar, cast((EddAmtOrPct3*100) AS decimal(10,0))) + '%'
    ELSE null
    END,' ') as ThirdDepositAmount,
    Supervisor,
    eec.eecEEID AS [Employee EEID],
    eec.EecJobCode As [Job Code],
    isnull(eec.EecTimeclockID,' ') As [Time Clock ID],
    con.[Emer Contact Last Name],
    con.[Emer Contact First Name],
    con.[Emer Contact Middle Initial/Name],
    con.[Emergency Phone]
    from [ultiprosqlprod1].[ultipro_crum].dbo.empPers eep WITH (NOLOCK)
    inner join [ultiprosqlprod1].[ultipro_crum].dbo.empComp eec WITH (NOLOCK)
    ON eep.eepEEID = eec.eecEEID
    inner join #tmp_Company cmp WITH (NOLOCK)
    ON eec.eecCOID = cmp.cmpCOID
    inner join [ultiprosqlprod1].[ultipro_crum].dbo.PayGroup pgr WITH (NOLOCK)
    ON eec.eecPayGroup = pgr.pgrPayGroup
    left outer join [ultiprosqlprod1].[ultipro_crum].dbo.TrmReasn
    on tchCode = eecTermReason
    left join (select CAST(sum(isnull(eee.eeeYTDHrs,0.00))AS DECIMAL(18,2)) as [YTD Hours],
    eeeEEID,
    eeeCOID
    from [ultiprosqlprod1].[ultipro_crum].dbo.EmpEarn eee with (NOLOCK)
    group by eeeCOID,eeeEEID)eee
    on eec.eecEEID = eee.eeeEEID
    and eec.eecCOID = eee.eeeCOID
    left join (SELECT eetCOID AS COID,
    eetEEID AS EEID,
    eetTaxCode AS TAXCODE,
    eetFilingStatus AS FILINGSTATUS,
    eetExemptions AS EXEMPTIONS,
    eetExtraTaxDollars AS ADDITIONAL
    FROM [ultiprosqlprod1].[ultipro_crum].dbo.empTax WITH (NOLOCK)
    WHERE eetTaxCode = 'USFIT'
    )eetFED
    ON eec.eecCOID = eetFED.COID
    and eec.eecEEID = eetFED.EEID
    left join (SELECT eetCOID AS COID,
    eetEEID AS EEID,
    eetTaxCode AS TAXCODE,
    eetFilingStatus AS FILINGSTATUS,
    eetExemptions AS EXEMPTIONS,
    eetExtraTaxDollars AS ADDITIONAL
    FROM [ultiprosqlprod1].[ultipro_crum].dbo.empTax WITH (NOLOCK)
    WHERE eetTaxCode like '%SIT'
    AND eetIsWorkInTaxCode = 'Y'
    )eetSIT
    ON eec.eecCOID = eetSIT.COID
    and eec.eecEEID = eetSIT.EEID
    left outer join (SELECT eddCOID,
    eddEEID,
    eddEEBankName BankName1,
    eddEEBankRoute BankRoute1,
    eddAcct Account1,
    EddAcctType AcctType1,
    EddDepositRule DepositRule1,
    EddAmtOrPct EddAmtOrPct1
    FROM [ultiprosqlprod1].[ultipro_crum].dbo.EmpDirDp WITH (NOLOCK)
    WHERE eddSequence = '99')edd
    ON eec.eecCOID = edd.eddCOID
    and eec.eecEEID = edd.eddEEID
    left outer join (SELECT eddCOID,
    eddEEID,
    eddEEBankName BankName2,
    eddEEBankRoute BankRoute2,
    eddAcct Account2,
    EddAcctType AcctType2,
    EddDepositRule DepositRule2,
    EddAmtOrPct EddAmtOrPct2
    FROM [ultiprosqlprod1].[ultipro_crum].dbo.EmpDirDp WITH (NOLOCK)
    WHERE eddSequence = '01')edd2
    ON eec.eecCOID = edd2.eddCOID
    and eec.eecEEID = edd2.eddEEID
    left outer join (SELECT eddCOID,
    eddEEID,
    eddEEBankName BankName3,
    eddEEBankRoute BankRoute3,
    eddAcct Account3,
    EddAcctType AcctType3,
    EddDepositRule DepositRule3,
    EddAmtOrPct EddAmtOrPct3
    FROM [ultiprosqlprod1].[ultipro_crum].dbo.EmpDirDp WITH (NOLOCK)
    WHERE eddSequence = '02')edd3
    ON eec.eecCOID = edd3.eddCOID
    and eec.eecEEID = edd3.eddEEID
    left outer join (SELECT eecCOID,
    eecEEID,
    rtrim(eepNameLast) + ', ' +
    rtrim(eepNameFirst) + ' ' +
    isnull(rtrim(ltrim(eepNameMiddle)), '') AS [Supervisor]
    FROM [ultiprosqlprod1].[ultipro_crum].dbo.EmpComp WITH (NOLOCK)
    join [ultiprosqlprod1].[ultipro_crum].dbo.EmpPers with (NoLock)
    on eeceeid = eepeeid)eec2
    ON eec.eecSupervisorID = eec2.eecEEID
    left outer join #tmp_Contacts con
    on eep.eepEEID = con.ConEEID
    order by [Client ID],
    [Last Name],
    [First Name]
    drop table #tmp_Contacts
    END
    Timothy E Caldwell

Maybe you are looking for