You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by "Ockleford Paul (NHS CONNECTING FOR HEALTH)" <pa...@nhs.net> on 2012/12/17 16:28:03 UTC

More questions on async service

Hi,

I am still pretty confused by the whole async services with axis 2. I bought deepaks book purely for this but it really doesn't go into any detail and looks to be pretty much the same as the axis documentation. I have created a very basic service which echoes a string, it's just a single method in a pojo and I have deployed this service successfully.

I have used wsdl2java to create me some client side code and I have included the option to create the async bits as well. Now trying to follow the documentation I cannot go any further because I don't get any of the methods the documentation describes, why is this? What I get is a call back interface and I have implemented the call back successfully but how exactly am I supposed to implement a polling client? On my stub client I only have 2 methods available to me:

SayHelloResponse sayHello(SayHello sayHello12 ) - this looks like the standard rpc call and the response object does not have an isDone() method to poll;

Void startSayHello(SayHello sayHello12 ) - this is the callback method which I managed to get working (see code below but don't see how to implement the polling mechanism or how to set the mep async property for).


My second problem is that I would like to make the service truly asynchronous by setting property "org.apache.axis2.jaxws.use.async.mep" to true but I don't see how it's possible to do this using the objects provided by wsdl2java.



I have included my code below in the hope that I get some feedback but I am beginning to think that I need look for a web services engine which is a little more user friendly than axis2 because I don't seem to be getting anywhere with it.



Simple web service:



public class HelloWorld {

       public String sayHello(String name){

        return "Hello " + name;

    }

}

Simple client (How do I set the async mep property and how do I implement a polling client using the generated classes):

public class HelloWorldClient {

    public static void main(String[] args) {
        try {
            String s = new String("Obj");
            HelloWorldStub stub = new HelloWorldStub();
            HelloWorldCallbackHandlerImpl cb = new HelloWorldCallbackHandlerImpl(s);
            SayHello sayHello = new SayHello();
            sayHello.setName("Paul Ockleford");

           //************** HOW DO I IMPLEMENT THIS GIVEN THE CLASSES GENERATED BY WSDL2JAVA **********
            Map<String, Object> rc = ((BindingProvider) ????).getRequestContext();
            rc.put("org.apache.axis2.jaxws.use.async.mep", Boolean.TRUE);

            stub.startsayHello(sayHello, cb);

             synchronized (cb) {
                while (!cb.m_done) {
                    try {
                        cb.wait(100);
                    } catch (Exception e) {}
                }
            }

            if (cb.m_response != null) {
                 String reply = cb.m_response.get_return();
                 System.out.println("received reply: " + reply);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

Can anybody help me out with some small code snippets to show how to set the mep async propery with my code above and also how I would go about implementing the polling mechanism for the code above?

Thanks,

Paul

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

This message may contain confidential information. If you are not the intended recipient please inform the
sender that you have received the message in error before deleting it.
Please do not disclose, copy or distribute information in this e-mail or take any action in reliance on its contents:
to do so is strictly prohibited and may be unlawful.

Thank you for your co-operation.

NHSmail is the secure email and directory service available for all NHS staff in England and Scotland
NHSmail is approved for exchanging patient data and other sensitive information with NHSmail and GSi recipients
NHSmail provides an email address for your career in the NHS and can be accessed anywhere

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

Re: More questions on async service

Posted by robert lazarski <ro...@gmail.com>.
On Mon, Dec 17, 2012 at 12:28 PM, Ockleford Paul (NHS CONNECTING FOR
HEALTH) <pa...@nhs.net> wrote:
>
> My second problem is that I would like to make the service truly
> asynchronous by setting property “org.apache.axis2.jaxws.use.async.mep” to
> true but I don’t see how it’s possible to do this using the objects provided
> by wsdl2java.
>
>

I don't have much to add on your new questions except to say you may
be mixing axis2 async implementations. Anything with jaxws in its
package name is standard with implementation inside and outside of
axis2.

Its been several years but the last time I coded async services, I
followed the axis2 guide and I purposely avoided jaxws, ymmv. Anyway
its not easy to find, but did you follow these async docs?

http://axis.apache.org/axis2/java/core/docs/adv-userguide.html

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


RE: More questions on async service

Posted by "Ockleford Paul (NHS CONNECTING FOR HEALTH)" <pa...@nhs.net>.
I don't have much to add on your new questions except to say you may
be mixing axis2 async implementations. Anything with jaxws in its
package name is standard with implementation inside and outside of
axis2.

Its been several years but the last time I coded async services, I
followed the axis2 guide and I purposely avoided jaxws, ymmv. Anyway
its not easy to find, but did you follow these async docs?

Well really I have just been trying to follow the documentation and I have read the link you just sent but the problem is the documentation isn't really very good.

I am not a web services expert but I have been tasked with upgrading to axis 2 and also investigating the asynchronous capabilities of axis 2 and unfortunately I don't seem to be able to find any complete examples with good commenting that I can follow.

All I want to do is expose a POJO method and then invoke it using async polling, async callback and async MEP callback, my implementation of the callback interface provided by wsdl2java looks really just like a polling mechanism but I am close to giving up at the moment. From reading the axis documentation it seems to imply axis was rewritten to make it more user friendly but this isn't my experience of it.


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

This message may contain confidential information. If you are not the intended recipient please inform the
sender that you have received the message in error before deleting it.
Please do not disclose, copy or distribute information in this e-mail or take any action in reliance on its contents:
to do so is strictly prohibited and may be unlawful.

Thank you for your co-operation.

NHSmail is the secure email and directory service available for all NHS staff in England and Scotland
NHSmail is approved for exchanging patient data and other sensitive information with NHSmail and GSi recipients
NHSmail provides an email address for your career in the NHS and can be accessed anywhere

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

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