⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 push.java

📁 联通WAP PUSH JAVA源代码,具体实现下载参考说明
💻 JAVA
字号:
package unicompush.Send;import java.util.*;import java.sql.*;import unicompush.db.*;import unicompush.util.*;import unicompush.Info.*;import javax.activation.*;import javax.mail.*;import java.net.*;import org.apache.soap.util.xml.*;import org.apache.soap.*;import org.apache.soap.rpc.*;/** * <p>Title: PUSH网关(适合联通华友平台)</p> * <p>Description: 仅以此系统献给奋斗在联通WAP业务前线的同事们</p> * <p>Copyright: Copyright (c) 2004</p> * <p>Company: Entel Communication Co,Ltd</p> * @author   Reedy * @version 1.0 */public class Push {    private static String LogFile = "Send";    public Push(){}  public static int PushMsg(SendInfo info)    {    try{  // Build the call.   Call call = new Call ();   //设置调用的方法名   call.setMethodName("pushMSG");   //设置编码风格   call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);   //设置方法调用的参数   Vector params = new Vector ();   params.addElement (new Parameter("fromUserMobile", String.class, new String (info.getFromMobile()), null));   params.addElement (new Parameter("toUserMobile", String.class, new String (info.getToMobile()), null));   params.addElement (new Parameter("alertTitle", String.class, new String (info.getalertTitle()), null));   params.addElement (new Parameter("alertURL", String.class, new String (info.getalertUrl()), null));   params.addElement (new Parameter("needBilling", Boolean.class, new Boolean (false), null));   call.setParams(params);   //发送RPC请求    URL url = new URL("http://211.94.69.247/pushsender/services/PushSIServicePort");    Response resp = call.invoke (url,"");   if (resp.generatedFault ()) {  //远程调用出错处理       Fault fault = resp.getFault ();       Logger.writeLog("push error--the call failed--Fault Code=" +                   fault.getFaultCode () + "--Fault String=" +                   fault.getFaultString (),LogFile);       return -1;   } else { //调用成功,获取返回值       Parameter result = resp.getReturnValue ();       int finalresult = -1;         try{               String r = (String)result.getValue().toString();               Logger.writeLog(">>" + r,LogFile);              if ((r.indexOf("1000"))>-1||(r.toString().indexOf("1001")>-1)) finalresult = 0;         }         catch(Exception e)         {             finalresult = -1;         }       return finalresult;   }    }    catch(Exception e)    {             Logger.writeLog("push error"+e.getMessage(),LogFile);             return -1;    }}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -