Get a place of attribution query via WebService

Source: Internet
Author: User
Tags wsdl

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! ^_^

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.