1. Query the WSDL link provided by the other side and generate the source file through the link and the WSDL tool.
EG:WSDL address is: Http://sersh.passport.189.cn/UDBAPPInterface/UDBAPPSYS/AccountLogin.asmx?WSDL
Open cmd and enter the following command: Wsimport-extension-s d:/test Http://sersh.passport.189.cn/UDBAPPInterface/UDBAPPSYS/AccountLogin.asmx?WSDL
2. On the Apache website, download CXF related jar package. (Apache-cxf-2.7.4.zip)
3. Import the related jar package into the project, write the client query code. (Provided that the WebService server is deployed)
[Java] View Plain copy print? public static void main (String[] args) throws malformedurlexception { system.out.println ("start."); IMSILoginResult login = Getimsiloginresultfromqgudbbyimsi ("460030136905408"); system.out.println ("mobile is " + login.getuserid ()); } private static String serviceUrl = "http://sersh.passport.189.cn/ Udbappinterface/udbappsys/accountlogin.asmx? WSDL "; private static string qgudb_deviceno = "3500000000408501 "; private static string qgudb_deskey = "75bd2e98ac17564b2db7c74b064f5084c6557fddf3e4c286"; Public static <t> t getisagservice (class<t> serviceclass, string serviceurl) { final Jaxwsproxyfactorybean factory = new jaxwsproxyfactorybean (); factory.setserviceclass (ServiceClass); factory.setaddress (serviceurl); return (T) factory.create (); } /** * No agent, through the IMSI number queryReturns the FJUDB data (as long as the object returns, it is 0, the success State.) * @param IMSI * @return * @throws MalformedURLException * @throws Exception */ private static imsiloginresult getimsiloginresultfromqgudbbyimsi (String imsi) throws malformedurlexception { system.setproperty (" Http.proxyhost ", " 192.168.13.19 "); System.setproperty ("Http.proxyport", "7777"); // url url = new url (serviceurl); // // &nbsP; url url = webserviceutil.class.getresource ("/ Conf/accountlogin_china.xml "); // // url url = new url ("file:\\c:\\users\\ffcs-4\\desktop\\ Accountlogin.xml "); // qname name = new QName ("http://udb.chinatelecom.com", "AccountLogin"); // Accountlogin accountlogin = new accountlogin (url, name); // accountloginsoap accountloginsoap = accountlogin.getaccountloginsoap (); accountloginsoap accountloginsoap = getisagservice (AccountLoginSoap.class, serviceurl); &nbsP string srcssdeviceno = qgudb_deviceno; String AuthSsDeviceNo = QGUDB_DEVICENO; String UDBTokenFlag = "0"; String IPAddress = "218.5.99.35"; date date = new date (); simpledateformat dateformat = new simpledateformat ( "Yyyy-mm-dd hh:mm:ss" ); String TimeStamp = Dateformat.format (date); String Extension = ""; //The fields into a string string authenticator1 = srcssdeviceno + authssdeviceno + imsi + UDBTokenFlag + IPAddress + TimeStamp + Extension; string authenticator2 = cryto.generateauthenticator ( authenticator1,qgudb_deskey, "Utf-8"); imsiloginrequest imsiloginrequest = new imsiloginrequest (); imsiloginrequest.setauthenticator (Authenticator2); &Nbsp; imsiloginrequest.setauthssdeviceno (Authssdeviceno); imsiloginrequest.setextension (Extension); imsiloginrequest.setimsi (IMSI); Imsiloginrequest.setipaddress (IPAddress); Imsiloginrequest.setsrcssdeviceno (Srcssdeviceno); Imsiloginrequest.settimestamp (TimeStamp); Imsiloginrequest.setudbtokenflag (udbtokenflag); Imsiloginresponse imsiloginresponse = accountloginsoap.imsilogin (imsiLoginRequest); IMSILoginResult imsiLoginResult = Imsiloginresponse.getimsiloginresult (); &nBsp IMSILoginResult result = null; //If the return status is 0 o'clock, the query succeeds if (Imsiloginresult.getresultcode () == 0) { result = imsiLoginResult; } return result; }