axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ockleford Paul (NHS CONNECTING FOR HEALTH)" <>
Subject More questions on async service
Date Mon, 17 Dec 2012 15:28:03 GMT

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");

            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 {
                    } catch (Exception e) {}

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

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?




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
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


View raw message