使用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]);
}
}
*@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]);
}
}
相关文章推荐
- 使用WebService的方式调用部署在服务器的Wcf服务
- 使用C#创建webservice本地调用方式
- c++ builder 使用indy http调用webservice方法
- java使用axis调用webservice时出现Connection reset by peer: socket write error的一种解决方法
- 使用C#创建webservice及三种调用方式
- .Net下采用GET/POST/SOAP方式动态调用WebService的简易灵活方法(C#)
- 使用jquery的ajax方法调用webservice服务
- 使用xfire方式调用webservice接口
- JSP+jquery使用ajax方式调用json的实现方法
- 使用C#调用Java带MIME附件WebService方法的初步设想
- java调用.NET的webservice实例的二种方法soap方式axis模式
- Android使用ksoap2调用C#中的webservice函数方法
- ASP.NET2.0下使用AJAX调用Webservice的方法
- .Net下采用GET/POST/SOAP方式动态调用WebService的简易灵活方法(C#)
- Struts2.5使用通配符的方式实现动态方法调用报错
- webservice 优化性能的方法,以返回Dataset为例,当大数据量时采用先压缩的方式,调用再解压缩
- 使用C#创建webservice及三种调用方式
- axis2客户端调用免费的webservice服务的实例之三axis2使用RPC方式调用网上免费WebService
- 使用C#调用Java带MIME附件WebService方法的初步设想
- VMWare安装Ubuntu10.10 server版的NAT方式上网方法,以及apt-get使用公司代理安装程序的方法