Please help somebody. I am facing this problem from very long time.

 


From: nancy [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 01, 2006 10:33 AM
To: [email protected]
Subject: READ TIME OUT using NONBlocking client

 

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

 

 


 

 

Reply via email to