To answer my own question... I got the answer here:
http://lhein.blogspot.com/2008/09/apache-cxf-and-time-outs.html

<http://lhein.blogspot.com/2008/09/apache-cxf-and-time-outs.html>Basically,
I added the following code after I get the PublishAsync port:

        HTTPConduit http = (HTTPConduit) client.getConduit();
        HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
        httpClientPolicy.setConnectionTimeout(0);
        httpClientPolicy.setReceiveTimeout(0);

        http.setClient(httpClientPolicy);

Need to come up w/ better number than "0" in there, but for now I know it
works...


On Wed, Mar 17, 2010 at 5:56 PM, Bryce Fischer <[email protected]>wrote:

> Trying to execute a web service asynchronously. The stack trace is at the
> end of the email. This is my code:
>
>     public static void main(String args[]) throws Exception {
>         File wsdl = new File(args[0]);
>
>         PublishService ps = new
> com.xxx.service.PublishService(wsdl.toURL(),
> com.xxx.service.PublishService.SERVICE);
>         ExecutorService executor = Executors.newFixedThreadPool(5);
>
>         ps.setExecutor(executor);
>
>         PublishAsync port = ps.getPublishAsync();
>
>         OtPublish request = new OtPublish();
>         request.setMapFileName(MAP_FILENAME);
>         request.setTransType(TRANSTYPE);
>
>         Response<OtResponse> response = port.publishAsync(request);
>
>         OtResponse pubFileResponse = response.get();
>         //OtResponse pubFileResponse = response.get(1L, TimeUnit.HOURS); //
> Tried this too
>
>         System.out.println("Server responded through polling with: " +
> pubFileResponse.getPublishedFileName());
>     }
>
> No matter what I do there, the socket times out after 60 seconds. I can see
> the web service continue on for a couple of minutes and completes (and
> throws an exception I'm guessing because the connection timed out?)
>
>
> Exception in thread "main" java.util.concurrent.ExecutionException:
> java.net.SocketTimeoutException: Read timed out
> at org.apache.cxf.endpoint.ClientCallback.get(ClientCallback.java:129)
>  at
> org.apache.cxf.jaxws.JaxwsResponseCallback.get(JaxwsResponseCallback.java:49)
> at com.xxx.service.client.PublishClient.main(PublishClient.java:35)
>  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>  at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
>  at com.intellij.rt.execution.application.AppMain.main(AppMain.java:110)
> Caused by: java.net.SocketTimeoutException: Read timed out
> at java.net.SocketInputStream.socketRead0(Native Method)
>  at java.net.SocketInputStream.read(SocketInputStream.java:129)
> at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
>  at java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
> at java.io.BufferedInputStream.read(BufferedInputStream.java:317)
>  at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:687)
> at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:632)
>  at
> sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1000)
> at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:373)
>  at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:2110)
> at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream$1.run(HTTPConduit.java:2092)
>  at
> org.apache.cxf.workqueue.AutomaticWorkQueueImpl$2.run(AutomaticWorkQueueImpl.java:253)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
>  at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
> at java.lang.Thread.run(Thread.java:619)
>

Reply via email to