The first thing to implement is the SSO interface, the focus is encrypted. Refer to the article on 9CBS, it will be possible,
Note that after 3DES, use Base to encode back to generate extra carriage return, remove them again URLENCODER
When writing encryption, the decryption is written, and it will be used to take TaskID when Push is.
Then Push, the PUSH process is SP-> Unicom -> SF, where China Unicom just verifies the header portion. Then submit the encapsulation to AXI.
If the encapsulation format is wrong, Push returns an error code is also 0, but the mobile phone does not receive information.
The encryption of Baotou uses ready-made, and the encapsulation is constructed with MIMEMESSAGE. This is a class of javamail.
Connection HttpurlConnection,
Public void connectURL (string strurl) {Try {url = new url ("http", "pushservice.uni-wise.com", 80, "/imappushsubmit.aspx"); hconn = (httpurlconnection) URL.OpenConnection (); Hconn.setRequestMethod ("pos"); hconn.setdooutput (true); hconn.setdoinput (true);} catch (exception ex) {system.out.println (ex);}}
Build an apparatus
Private void setMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMimeMime (); serverip = "smtp.sina.com.cn"; system.out.println (Serverip); Props.Put ("mail.smtp.host", ServerIP ); Session session = Session.getInstance (props, null); session.setDebug (true); mime = new MimeMessage (session); mime.setFrom (new InternetAddress ( "cheng_shiyong@yahoo.com.cn", new String (strFrom .getBytes ( "ISO8859_1"), "GB2312"), "GB2312")); mime.addRecipient (javax.mail.Message.RecipientType.TO, new InternetAddress (strTo)); mime.setSubject (new String (strSubject.getBytes ("ISO8859_1"), "GB2312"), "GB2312"); mime.setsentdate (new java.util.date ()); mime.setContent (GetMimeMultipart ());} catch (exception ex) {system.out. Println ("MME.PUSH.SETMIMEMESSAGE ERROR" EX);}}
private MimeMultipart getMimeMultipart () {MimeMultipart mimeMultipart = new MimeMultipart (); MimeBodyPart mimeBodyPart = new MimeBodyPart (); try {mimeBodyPart.setText (new String (mimeBodyText.getBytes ( "ISO8859_1"), "GB2312"), "GB2312"); mimeMultipart.addBodyPart (mimeBodyPart); Vector filePathes = getFilePaths (); for (int i = 0; i Send information MimeMessage.Writeto (HCONN.GETOUTPUTSTREAM ()); Read Unicom return information BufferedReader Rd = New BufferedReader (NEWNN. GetInputStream ())); for (String line = null; (line = rd.readline ())! = Null;) { Sb.append (line); In the middle, the JAF report does not support the Multipart / Mixed type error. The reason for this error is that there are multiple mail packages in the system, and the solution is to put Jaf and Mail below WEB-INF / LIB. Delete a copy of other places. In addition, Unicom returned to the wrong code is 10, and it is necessary to convert into 16-based to find it in the wrong table. It's just that yourself, write very messy. Ha ha