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);
}
}
Visit it is OK !

本文介绍了如何利用Webxml接口和CXF工具进行WebService调用。首先,了解Webxml用于查询手机号码归属地的接口。然后,下载并使用CXF将WSDL转换为Java代码。通过示例展示了如何创建Java客户端,调用getMobileCodeInfo方法查询指定号码的归属地,最后验证了查询操作的成功。
123

被折叠的 条评论
为什么被折叠?



