1. This blog post does not cover the basics of WebService.
2. Use the free WebService to achieve attribution queries.
3. The following URL is the address of the WSDL file
http://webservice.webxml.com.cn/WebServices/MobileCodeWS.asmx?wsdl
4. First build a Dynamic Web project or Java project can also.
5. Open the CMD window to locate the path to the project SRC. (My working path is D:\workspace\day6-18phone_ws\src)
6. Then proceed with the operation and then enter.
Explanation:Wsimport is a tool in the bin of the JDK
-keep hold
The following URL is the online WSDL file address ( Note that the entire process must be connected, including subsequent tests )
7. Then refresh your project, you will see the following effect ( no com.alibaba.miao.test This package, this is a test package, followed by introduction )
8. Write the Test class. (It is important to find the factory class)
Find the factory class name in the WSDL file
Write the test class according to the class name:
The code is as follows:
1 Packagecom.alibaba.miao.test;2 3 ImportCn.com.webxml.MobileCodeWS;4 ImportCn.com.webxml.MobileCodeWSSoap;5 6 Public classClienttest {7 8 Public Static voidMain (string[] args) {9 //Mobilecodews is a factory classTenMobilecodews mobilecodews =Newmobilecodews (); One //shortcut key Alt+shift+l Auto-complete return value A //Mobilecodewssoap is an interface -Mobilecodewssoap Mobilecodewssoap =Mobilecodews.getmobilecodewssoap (); -String codeinfo = Mobilecodewssoap.getmobilecodeinfo ("18346183865", the NULL); - System.out.println (codeinfo); - } -}
View Code
SOURCE Download: http://download.csdn.net/detail/sxmiaochuang/7518011
The use of the first such a lot, to get the weather, stocks, different programming language website communication, shopping.
Well, a simple WebService success, if you feel better praise Oh! ^_^