Package testClick. src. test; import javax. xml. namespace. QName; 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.addressing. endpointReference; import org. apache. axis2.client. options; import org. apache. axis2.client. serviceClient; import org. a Pache. axis2.rpc. client. RPCServiceClient; import org. junit. test; import testClick. src. testclick. helloWebService; import testClick. src. testclick. helloWebServicePortType; public class TestWebservice {@ Testpublic void Test () {// testClient (); // testRPC (); testOMElement ();} /*** first ** MyEclipse client Generation Method */public void testClient () {HelloWebService service = new HelloWebService (); HelloWebServicePortType portType = Service. getHelloWebServiceHttpSoap11Endpoint (); String result = portType. sayHello ("jack"); System. out. println (result);}/*** second type * use axis2 RPC to call webservice. You need to import the corresponding jar package */public void testRPC () {try {RPCServiceClient client = new RPCServiceClient (); Options options = client. getOptions (); String url = "http: // localhost: 8080/axis2/services/HelloWebService? Wsdl "; EndpointReference end = new EndpointReference (url); options. setTo (end); Object [] obj = new Object [] {" tom "}; Class <?> [] Classes = new Class [] {String. class}; QName qname = new QName ("http: // testClick", "sayHello"); String result = (String) client. invokeBlocking (qname, obj, classes) [0]; System. out. println (result);} catch (AxisFault e) {e. printStackTrace () ;}}/*** third type * @ throws AxisFault */public void testOMElement () {try {ServiceClient SC = new ServiceClient (); options opts = new Options (); String url = "http: // localhos T: 8080/axis2/services/HelloWebService? Wsdl "; EndpointReference end = new EndpointReference (url); opts. setTo (end); opts. setAction ("sayHello"); SC. setOptions (opts); OMFactory fac = OMAbstractFactory. getOMFactory (); OMNamespace omNs = fac. createOMNamespace ("http: // testClick", ""); OMElement method = fac. createOMElement ("sayHello", omNs); OMElement value = fac. createOMElement ("name", omNs); value. setText ("admin"); method. addChild (value); OMElement res = SC. sendReceive (method); res. getFirstElement (). getText (); System. out. println (res. getFirstElement (). getText ();} catch (AxisFault e) {e. printStackTrace ();}}}