Topic: java+webservice

  Print this page

1.java+webservice Copy to clipboard
Posted by: ggloverv
Posted on: 2010-08-03 14:29

Sad
找到一家短信接入的公司,他们的接口是webservice形式的。现在搞活动,可以注册免费发短信。。但不会接入,求代码。。。

========================

webservice地址:http://121.37.58.18:8080/

可以到这里注册试用,貌似有免费短信8条发送。-_-||

http://www.mmlj.cn/

2.Re:java+webservice [Re: ggloverv] Copy to clipboard
Posted by: 690716494
Posted on: 2010-12-18 14:30

Java平台实现:

static String url = "http://121.37.58.18:8080/SMSWebService/services/SMS";
public static void main(String[] args) {
System.out.println(doSendMessage("基本账号;账号密码;手机号码清单(多个中间用","隔开);信息内容".split(";")));
}

/***
* 发送信息
* */
public static String doSendMessage(String[] temp){
String result = "";
Call call = getCall();
call.setTargetEndpointAddress(url);
call.setOperationName("sendMessage");//WSDL里面描述的接口名称//接口的参数
call.addParameter("userAcc", XMLType.XSD_STRING,
ParameterMode.IN);//接口的参数
call.addParameter("passwd", XMLType.XSD_STRING,
ParameterMode.IN);
call.addParameter("telNumber", XMLType.XSD_STRING,
ParameterMode.IN);
call.addParameter("message", XMLType.XSD_STRING,
ParameterMode.IN);
call.setReturnType(XMLType.XSD_STRING);//设置返回类型
try {
result = (String)call.invoke(temp);
} catch (RemoteException e) {
}
return result;
}

/***
* 获得CALL
* */
public static Call getCall(){
Service service = new Service();
Call call = null;
try {
call = (Call)service.createCall();
} catch (ServiceException e) {
}
return call;
}


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2020 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号
客服电话 0592-8750026    客服信箱 714923@qq.com    客服QQ 714923