axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stadelmann Josef" <josef.stadelm...@axa-winterthur.ch>
Subject AW: Async axis client call timing out
Date Thu, 04 Aug 2011 07:30:10 GMT
Yes, second line is OK and I use it in my client code since Axis2-1.2 as
well. But this alone is not sufficient! How does Axis2 know where to get
module addressing from? You have to establish a context which knows
about this location. So my test client below works for me since
axis2-1.2/J

 

My first 6 year old test client is going out for long lasting sessions
and state full objects; each client session-thread reaches its own
instance of a service class, it's service-object, demonstrating that if
you launch this client 5 times, each client will talk to its state-full
service-object. But this works only if you run your server in
scope="soapsession" where as scope is defined in the service.xml. And
you need a init() and a destroy() method in your service -class. i.e. 

 

 

public void init(ServiceContext sCtx) throws XMLStreamException { 

}

and 

 

public void destroy(ServiceContext sCtx) throws XMLStreamException {

}

 

 

/* my test client calling SpezplaService in scope="soapsession"

public class SOAPSpezplaClient {

    

    private static final Log log =
LogFactory.getLog(SOAPSpezplaClient.class);

    private static String toEpr =
"http://integ1:8180/axis2/services/SpezplaService";

    

    private static int i = 0;

    private static Integer intObj = new Integer(i);

    

    public static void main(String[] args) throws AxisFault {

        

        try {

            

            Options options = new Options();

            options.setManageSession(true);

            options.setTo(new EndpointReference(toEpr));

            options.setTransportInProtocol(Constants.TRANSPORT_HTTP);

            

            /**

             * on OpenVMS user.home  is dsa5:[stadelma]

             * on windows user.home  is C:\Documents and
Settings\c770817

            **/

            String home = System.getProperty("user.home");

            // create this folder at your home. This folder could be
anything

            //then create the "modules" folder

            //copy the LoggingModule.mar to "modules" folder.

            //copy the axis2.xml to the client-repository

            //then modify the axis2.xml that is generating there
according to

            //phases that being included in the "module.xml"

            

            /**

             * on OpenVMS repository is
dsa5:[stadelma.client-repository] or /dsa5/stadelma/client-repository

             * on windows repository is C:\Documents and
Settings\c770817\client-repository

             **/

            File repository = new File(home + File.separator +
"client-repository");

            if (!repository.exists()) {

                throw new
FileNotFoundException(repository.getAbsolutePath() + " does not Exist");

            };

            

            String str_axis2xml = repository.getAbsolutePath() +
File.separator + "axis2.xml";

            File axis2_xml = new File(str_axis2xml);

            if (!axis2_xml.exists()) {

                throw new
FileNotFoundException(axis2_xml.getAbsolutePath() + " does not Exist");

            };

            

            FileSystemConfigurator fsc = new FileSystemConfigurator(

                    repository.getAbsolutePath(),

                    axis2_xml.getAbsolutePath());

            

            AxisConfiguration er = fsc.getAxisConfig();

            

            ConfigurationContext configContext =

 
ConfigurationContextFactory.createConfigurationContextFromFileSystem(

                    repository.getAbsolutePath(),

                    axis2_xml.getAbsolutePath()

                    );

            

            

            ServiceClient sender = new
ServiceClient(configContext,null);

            

            //sender.engageModule(new QName(Constants.MODULE_LOGGING));

            sender.engageModule(new QName("SpezplaLogging-1.2"));

            

            sender.engageModule(new QName(Constants.MODULE_ADDRESSING));

            //sender.engageModule(new QName("addressing-1.2"));

            

            //sender.engageModule(new
QName(Constants.MODULE_SOAPMONITOR));

            sender.engageModule(new QName("soapmonitor-1.2"));

            

            

 
options.setSoapVersionURI(org.apache.axiom.soap.SOAP12Constants.SOAP_ENV
ELOPE_NAMESPACE_URI);

            

            

            // invoke the start method first using it's StartPaylod

            options.setAction("urn:login");

            sender.setOptions(options);

            

            OMElement element = getLoginPayload(0);

            

            /** now we know we can potentially succeed to create a
OpenVmsLogin(u,p) **/

            

            OMElement start = sender.sendReceive(element);

            // from now on use this sender so that WS-address stuff i.e.
ServiceGroupeContextID info is sent

            

            

            String s = intObj.toString(i);

            System.out.print("No"+s);

            

            XMLStreamWriter startWriter =
XMLOutputFactory.newInstance().createXMLStreamWriter(System.out);

            start.serialize(startWriter);

            startWriter.flush();                // write every-thing out

            System.out.println("");             // and add a CRLF

            

            

            

            

            options.setAction("urn:fktmap");

            sender.setOptions(options);

            

            OMElement result = sender.sendReceive(getFktmapPayload(50));

            

            for(int i=0;i<100;i++){

                

                result =
sender.sendReceive(getFktmapPayload_FKT_BATCH_LOG(20));

                

                Thread.sleep(40000);

                

                s = intObj.toString(i);

                System.out.println("No"+s);

                                

                if (i==100){

                    System.gc();    // do an explicit Garbage Collection
and get it all back

                }

                if (0 == i % 100){

                    System.gc();    // do an explicit Garbage Collection
once evry 100 loops-through

                }

            } // end-for - so do a cleanup now to give up sender
resource

            

            // invoke the logout method

            options.setAction("urn:logout");

            sender.setOptions(options);

            

            result = sender.sendReceive(getLogoutPayload(0));

            //sender.fireAndForget(getLogoutPayload());

            // from now on use this sender so that WS-address stuff i.e.
ServiceGroupeContextID info is sent

            // where in the dark of the code is that?

            

            

            /**

             * We have to block this thread until we send the request ,
the problem

             * is if we go out of the main thread , then request won't
send ,so

             * you have to wait some time :)

             */

            Thread.sleep(2500);

            

            /**

             * s = intObj.toString(i);

             * System.out.print("No"+s);

             *

             * XMLStreamWriter pingWriter =
XMLOutputFactory.newInstance().createXMLStreamWriter(System.out);

             * ping.serialize(startWriter);

             * pingWriter.flush();                // write every-thing
out

             * System.out.println("");             // and add a CRLF

             **/

            sender.cleanup();   // return resources .finalize would do
more but is protected

            

        } catch (FileNotFoundException e) {

            e.printStackTrace();

        } catch (XMLStreamException e) {

            e.printStackTrace();

        } catch (FactoryConfigurationError e) {

            e.printStackTrace();

        } catch (java.lang.Exception e) {

            e.printStackTrace();

        }

    }

 

 

Von: Todd Chisholm [mailto:todd.chisholm@gmail.com] 
Gesendet: Mittwoch, 3. August 2011 19:47
An: java-user@axis.apache.org
Betreff: Re: Async axis client call timing out

 

Hi Josef,

Good question.  I have this in my client:

            sender = new ServiceClient();
            sender.engageModule(Constants.MODULE_ADDRESSING);
            sender.setOptions(options);
            sender.sendReceiveNonBlocking(payload, callback);
 
Is the second line sufficient to ensure the addressing module is
engaged?

Thanks,
Todd




On Wed, Aug 3, 2011 at 10:31 AM, Stadelmann Josef
<josef.stadelmann@axa-winterthur.ch> wrote:

On axis2 - addressing.mar is engaged globally by default. 

Look at the axis2 admin pages

But what about your client?

Josef?

 

Von: Todd Chisholm [mailto:todd.chisholm@gmail.com] 
Gesendet: Mittwoch, 3. August 2011 19:24
An: java-user@axis.apache.org
Betreff: Re: Async axis client call timing out

 

Thanks Martin and Deepal for your help with this.

I believe that the addressing module is engaged on the server side - to
be sure, I engaged it via the axis2-admin page.  No change,
unfortunately.

I've created a bug: https://issues.apache.org/jira/browse/AXIS2-5111
with the client and server code included.

Thanks,
Todd

On Tue, Aug 2, 2011 at 3:54 PM, Deepal jayasinghe <deepalk@gmail.com>
wrote:

Hi Todd,

Did you engage the addressing module in the server side ?. if not please
engage it and see the results.

if you have engaged addressing module and you still see the issue then
it is definitely an Axis2 bug. Someone should have broken something, so
please create a JIRA, (need to fix this ASAP)

Thanks.
Deepal

> Hi,
>
> I'm experimenting with asynchronous calls between an axis client and
> an axis server.  The server is just the example1/MyService.java,
> slightly modified to add a delay of a minute before replying.  The
> client is based on the EchoNonBlockingDualClient.java.  I'm getting a
> Read timed out AxisFault after 30 seconds, which leads me to believe
> the client is leaving the channel open.
>
> Here's some of the client code, with the options:
>
>             Options options = new Options();
>             options.setTo(targetEPR);
>             options.setAction("urn:echo");
>             options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
>             options.setUseSeparateListener(true);
>
>             //Callback to handle the response
>             BetterAxisCallback callback = new BetterAxisCallback();
>
>             //Non-Blocking Invocation
>             sender = new ServiceClient();
>             sender.engageModule(Constants.MODULE_ADDRESSING);
>             sender.setOptions(options);
>             sender.sendReceiveNonBlocking(payload, callback);
>
>             //Wait till the callback receives the response.
>             while(!callback.isComplete())  {
>                 Thread.sleep(1000);
>             }
>
> Shouldn't this wait indefinitely for a response on the separate
listener?
>
> Thanks,
> Todd
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org

 

 


Mime
View raw message