Package org.sky.axis2.helloworld.javatype; Import Org.apache.axiom.om.OMAbstractFactory; Import org.apache.axiom.om.OMElement; Import Org.apache.axiom.om.OMFactory; Import Org.apache.axiom.om.OMNamespace; Import Org.apache.axis2.AxisFault; Import org.apache.axis2.Constants; Import org.apache.axis2.addressing.EndpointReference; Import org.apache.axis2.client.Options; Import org.apache.axis2.client.ServiceClient; Import Org.apache.axis2.context.ConfigurationContext; Import Org.apache.axis2.context.ConfigurationContextFactory; public class Hellojavawithreturndualnonblock { private static EndpointReference Targetepr = new EndpointReference ( "Http://localhost:8080/Axis2Service/services/HelloJava"); public static Boolean finish = false; public void SayHello () { Omfactory FAC = omabstractfactory.getomfactory (); Omnamespace omns = Fac.createomnamespace ( "Http://javatype.helloworld.axis2.sky.org", "" "); Omelement method = Fac.createomelement ("SayHello", omns); Omelement name = fac.createomelement ("name", Omns); Name.settext ("YMK"); Method.addchild (name); Method.build (); Options options = new options (); Options.setto (TARGETEPR); Options.settransportinprotocol (constants.transport_http); Options.setuseseparatelistener (TRUE); Options.setaction ("Urn:sayhello"); ServiceClient sender = null; HELLOJAVANONBLOCKCB callback = new HELLOJAVANONBLOCKCB (); try { Sender = new ServiceClient (); Sender.engagemodule (constants.module_addressing); Sender.setoptions (options); Sender.sendreceivenonblocking (method, callback); Synchronized (callback) { try { Callback.wait (); } catch (Interruptedexception e) { E.printstacktrace (); } } } catch (Exception e) { E.printstacktrace (); } finally { try { Sender.cleanup (); } catch (Exception e) { } } } public static void Main (string[] args) { Hellojavawithreturndualnonblock testclient = new Hellojavawithreturndualnonblock (); Testclient.sayhello (); } } |