SOAP
1 Conditions
1. Webxml
Firstly , you should know this web : Webxml
2.CXF
Secondly,you are supposed to down a file that is called CXF from this web :CXF
3.How to use ?
3-1 Webxml is an interface to search mobile phone number where is from ?
3-2 CXF is a tool to trans wsdl to java . So you are supposed to know this instruct : wsdl2java.
2 Example
1. Visit Webxml
http://ws.webxml.com.cn/WebServices/MobileCodeWS.asmx?WSDL
2. WSDL2JAVA
- use this instruct under the bin mkdir :
http://ws.webxml.com.cn/WebServices/MobileCodeWS.asmx?WSDL
2. into the bin mkdir , you can see this file , copy it to your project
3 Client
package cn.com.client;
import cn.com.webxml.MobileCodeWS;
import cn.com.webxml.MobileCodeWSSoap;
public class ClientMain {
public static void main(String[] args) {
//创建一个MobileCodeWS工厂
MobileCodeWS factory = new MobileCodeWS();
//根据工厂创建一个MobileCodeWSSoap对象
MobileCodeWSSoap mobileCodeWSSoap = factory.getMobileCodeWSSoap();
//调用WebService提供的getMobileCodeInfo方法查询手机号码的归属地
String searchResult = mobileCodeWSSoap.getMobileCodeInfo("number", null);
System.out.println(searchResult);
}
}