1. Download axis
2. Create a web project under myeclipse
Import the Lib package under axis to the Lib center of the project.
3. Create a JavaBean telephoneaxis. Java
CodeAs follows:
Package COM. tools; 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. axiom. soap. soap11constants; 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.transport. HTTP. httpconstants; import Org. apache. axis2.transport. HTTP. httptransportproperties. proxyproperties; import Org. apache. commons. logging. log; import Org. apache. commons. logging. logfactory; public class telephoneaxis {Private Static endpointreference targetepr = new endpointreference ("http://webservice.webxml.com.cn/WebServices/MobileCodeWS.asmx"); Public void getresult () throws exception {string S = NULL; serviceclient sender = new serviceclient (); sender. setoptions (buildoptions (); omelement result = sender. sendreceive (buildparam (); s = result. getfirstelement (). gettext (); system. out. println (s);} Private Static omelement buildparam () {omfactory FAC = omabstractfactory. getomfactory (); omnamespace omns = FAC. createomnamespace ("http://WebXml.com.cn/", ""); omelement DATA = FAC. createomelement ("getmobilecodeinfo", omns); omelement inner = FAC. createomelement ("mobilecode", omns); inner. settext ("15874333 ***"); data. addchild (inner); return data;} Private Static options buildoptions () {options Options = new options (); options. setsoapversionuri (soap11constants. soap_envelope_namespace_uri); options. setaction ("http://WebXml.com.cn/getMobileCodeInfo"); options. setto (targetepr); // options. if setproperty does not access the Internet through a proxy, this sentence can save // options. setproperty (httpconstants. proxy, buildproxy (); options. settransportinprotocol (constants. transport_http); return options;}/*** when the local machine uses a proxy server to access the Internet, you need to set the proxy * @ return public static proxyproperties buildproxy () {proxyproperties = new proxyproperties (); proxyproperties. setproxyname ("proxy name"); proxyproperties. setproxyport (8080); Return proxyproperties;} */public static void main (string [] ARGs) throws exception {telephoneaxis S = new telephoneaxis (); S. getresult ();}}
4. Success. If you need to enter the phone number dynamically, you can add an index. jsp page.
5. To be continued .....