axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "nancy" <nancy.aggar...@daffodildb.com>
Subject READ TIME OUT using NONBlocking client
Date Tue, 01 Aug 2006 05:02:32 GMT
Hello,

 

            I want to use callback means nonblocking axis client to call
webservice.I am using following code for that.But even then read time out is
occurring.As my process can take several hours in responding,so I need this
kind of thing.Please help

 

 

****************************************************************************
****************************************************************************
***********

SOAPEnvelope resultEnvelope = null;

                        Options options = null;

                        try {

                                    options = new Options();

 
options.setTransportInProtocol(Constants.TRANSPORT_HTTP);

                        

                                    EndpointReference EPR = new
EndpointReference(webServiceURI);

 

                                    log.info("EndpointReference:" +
EPR.getAddress());

                                    options.setTo(EPR);

 

                                    options.setAction(operationName);

 

 

            //Callback to handle the response

            Callback callback = new Callback() {

                public void onComplete(AsyncResult result) {

                try {

                        StringWriter writer = new StringWriter();

 
result.getResponseEnvelope().serialize(XMLOutputFactory.newInstance()

                                .createXMLStreamWriter(writer));

                        writer.flush();

                        System.out.println(writer.toString());

 

 

                    } catch (XMLStreamException e) {

                        onError(e);

                    }

                }

 

                public void onError(Exception e) {

                    e.printStackTrace();

                }

            };            

 

                                    ServiceClient serviceClient;

                                    options.setUseSeparateListener(false);

 

                                    serviceClient = new ServiceClient();

                                    serviceClient.setOptions(options);

                                    OMElement
params1=getRequestOMElement(operationName, parameterMap,
"urn:CallWebService");

 
serviceClient.sendReceiveNonblocking(params1, callback);

         

                                    while (!callback.isComplete()) {

                                                Thread.sleep(1000);

                                      }

                        

 

                                       serviceClient.finalizeInvoke();

                                    

                        } catch (AxisFault ex) {

                                    ex.printStackTrace();

                        

                        } catch (InterruptedException ex) {


                                    ex.printStackTrace();


                        }

****************************************************************************
****************************************************************************
***********

 

            

With Warm Regards, 

Nancy Aggarwal 

 

 


 

 


Mime
View raw message