您的位置:首页 > 其它

使用Xire代理方式调用webservice方法

2011-06-14 23:45 881 查看
/**
*@Description:
*@ProjectName

*@version 1.0.0
*@author:<a href="mailto:lovekang89@163.com">zoukang</a>
*@date 2011-6-14
*/
/**
* @author:<a href="mailto:lovekang89@163.com">zoukang</a>
* @Date:2011-6-14
* @Describe:
*/
package com.gavin.service.mobile;

import java.net.MalformedURLException;
import java.net.URL;

import org.codehaus.xfire.client.Client;

public class Test {

private static Client client;

/**
* @param args
*/
public static void main(String[] args) {
Object[] results = null;
try {
client = new Client(
new URL(
"http://webservice.webxml.com.cn/WebServices/MobileCodeWS.asmx?wsdl")); //服务地址
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}

try {
results = client.invoke("getMobileCodeInfo", new Object[] {
"186888888", "" });//方法名和参数,如果没有参数就传一个空对象数组
} catch (Exception e) {
e.printStackTrace();
}
System.out.println((String) results[0]);

}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: