/*
* Copyright 2004-2005 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.sf.jml.protocol.soap;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.net.Socket;
import java.net.URL;
import java.util.ArrayList;
import java.util.Date;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import java.util.Map.Entry;
import java.util.Vector;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;
import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import net.sf.jml.MsnContactPending;
import net.sf.jml.MsnGroup;
import net.sf.jml.Email;
import net.sf.jml.MsnContact;
import net.sf.jml.MsnList;
import net.sf.jml.MsnProtocol;
import net.sf.jml.impl.AbstractMessenger;
import net.sf.jml.impl.MsnContactImpl;
import net.sf.jml.impl.MsnContactListImpl;
import net.sf.jml.impl.MsnGroupImpl;
import net.sf.jml.protocol.MsnSession;
import net.sf.jml.protocol.outgoing.OutgoingADL;
import net.sf.jml.protocol.outgoing.OutgoingBLP;
import net.sf.jml.protocol.outgoing.OutgoingCHG;
import net.sf.jml.protocol.outgoing.OutgoingRML;
import net.sf.jml.protocol.outgoing.OutgoingUUX;
import net.sf.jml.util.XmlUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.http.HttpHost;
import org.apache.http.HttpResponse;
import org.apache.http.HttpVersion;
import org.apache.http.impl.DefaultHttpClientConnection;
import org.apache.http.message.BasicHttpEntityEnclosingRequest;
import org.apache.http.params.BasicHttpParams;
import org.apache.http.params.HttpParams;
import org.apache.http.params.HttpProtocolParams;
import org.apache.http.protocol.BasicHttpContext;
import org.apache.http.protocol.BasicHttpProcessor;
import org.apache.http.protocol.ExecutionContext;
import org.apache.http.protocol.HttpContext;
import org.apache.http.protocol.HttpRequestExecutor;
import org.apache.http.protocol.RequestConnControl;
import org.apache.http.protocol.RequestContent;
import org.apache.http.protocol.RequestExpectContinue;
import org.apache.http.protocol.RequestTargetHost;
import org.apache.http.protocol.RequestUserAgent;
import org.apache.http.util.EntityUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.SAXException;
/**
* Manages contact list through the webservices exposed for
* MSN13 and later.
*
* @author Damian Minkov
*/
public class ContactList
{
private static final Log logger = LogFactory.getLog(ContactList.class);
private SSO sso;
private MsnSession session;
private static final String membership_url =
"https://omega.contacts.msn.com/abservice/SharingService.asmx";
// "https://by3.omega.contacts.msn.com/abservice/SharingService.asmx";
private static final String membership_soap =
"http://www.msn.com/webservices/AddressBook/FindMembership";
private static final String membership_soap_delete =
"http://www.msn.com/webservices/AddressBook/DeleteMember";
private static final String membership_soap_add =
"http://www.msn.com/webservices/AddressBook/AddMember";
private static final String addressbook_url =
"https://omega.contacts.msn.com/abservice/abservice.asmx";
// "https://by3.omega.contacts.msn.com/abservice/abservice.asmx";
private static final String addressbook_action_findall =
"http://www.msn.com/webservices/AddressBook/ABFindAll";
private static final String addressbook_action_add =
"http://www.msn.com/webservices/AddressBook/ABAdd";
private static final String addressbook_action_groupadd =
"http://www.msn.com/webservices/AddressBook/ABGroupAdd";
private static final String addressbook_action_groupdelete =
"http://www.msn.com/webservices/AddressBook/ABGroupDelete";
private static final String addressbook_action_groupupdate =
"http://www.msn.com/webservices/AddressBook/ABGroupUpdate";
private static final String addressbook_action_contactadd =
"http://www.msn.com/webservices/AddressBook/ABContactAdd";
private static final String addressbook_action_groupContactAdd =
"http://www.msn.com/webservices/AddressBook/ABGroupContactAdd";
private static final String addressbook_action_groupContactDelete =
"http://www.msn.com/webservices/AddressBook/ABGroupContactDelete";
private static final String addressbook_action_contactdelete =
"http://www.msn.com/webservices/AddressBook/ABContactDelete";
private static final String addressbook_action_contactupdate =
"http://www.msn.com/webservices/AddressBook/ABContactUpdate";
private Hashtable membersRoles = new Hashtable();
private String myDisplayName = null;
private static final String PREF_HOTNAME_NODE_START = "<PreferredHostName>";
private static final String PREF_HOTNAME_NODE_END = "</PreferredHostName>";
private static boolean ADLSent=false;
private static boolean firstADLReply=true;
ContactList(){this(null);}
public ContactList(MsnSession session)
{
this.sso = session.getSSO();
this.session = session;
membersRoles.put("Allow",
new MemberRole("Allow", MsnList.AL));
membersRoles.put("Block",
new MemberRole("Block", MsnList.BL));
membersRoles.put("Reverse",
new MemberRole("Reverse", MsnList.RL));
membersRoles.put("Pending",
new MemberRole("Pending", MsnList.PL));
}
private synchronized String sendRequest(String body, String address, String soapAddress, String method)
{
return sendRequest(body, address, soapAddress, method, false);
}
private synchronized String sendRequest(String body, String address, String soapAddress, String method, boolean secondTry)
{
//ConnectionReuseStrategy connStrategy = new DefaultConnectionReuseStrategy();
DefaultHttpClientConnection conn = new DefaultHttpClientConnection();
HttpParams params = null;
BasicHttpProcessor httpproc = null;
try
{
logger.trace("Will send body: " + body);
URL url = new URL(address);
if(params == null)
{
params = new BasicHttpParams();
HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
HttpProtocolParams.setContentCharset(params, "UTF-8");
//HttpProtocolParams.setUserAgent(params, "MSN Explorer/9.0 (MSN 8.0; TmstmpExt)");
HttpProtocolParams.setUseExpectContinue(params, false);
httpproc = new BasicHttpProcessor();
// Required protocol interceptors
httpproc.addInterceptor(new RequestContent());
httpproc.addInterceptor(new RequestTargetHost());
// Recommended protocol interceptors
httpproc.addInterceptor(new RequestConnControl());
httpproc.addInterceptor(new RequestUserAgent());
httpproc.addInterceptor(new RequestExpectContinue());
}
HttpRequestExecutor httpexecutor = new HttpRequestExecutor();
没有合适的资源?快使用搜索试试~ 我知道了~
资源详情
资源评论
资源推荐
收起资源包目录
android_msn源码 (558个子文件)
ContactList.class 44KB
OIM.class 22KB
AbstractMessenger.class 19KB
SSO.class 14KB
DisplayPictureRetrieveWorker.class 14KB
FileTransferWorker.class 11KB
Session.class 11KB
SimpleMessenger.class 9KB
FileTransferManager.class 9KB
MsnP2PMessage.class 9KB
DatatypeFactory.class 8KB
BasicMessenger.class 8KB
MsnInstantMessage.class 8KB
MsnOwnerImpl.class 8KB
DisplayPictureDuel.class 8KB
MsnMessageRecognizer.class 7KB
MsnObject.class 7KB
MsnAdapter.class 6KB
Duration.class 6KB
IncomingADL.class 6KB
MsnContactListImpl.class 6KB
StringUtils.class 6KB
MsnSession.class 6KB
CharsetUtils.class 6KB
IncomingUSR$1.class 6KB
MsnslpMessage.class 6KB
FactoryFinder.class 6KB
MsnClientId.class 6KB
MsnMessage.class 6KB
MsnSession$1.class 6KB
BasicSwitchboard.class 5KB
XmlUtils.class 5KB
MsnContactImpl.class 5KB
GUID.class 5KB
MsnListener.class 5KB
MsnFileTransferImpl.class 5KB
MsnslpResponse.class 5KB
MsnProtocolException.class 5KB
MsnFileInviteMessage.class 5KB
Base64$Base64Encoder.class 4KB
OutgoingQRY.class 4KB
MsnEmailInitEmailData.class 4KB
MsnMimeMessageFactory.class 4KB
NumberUtils.class 4KB
IncomingUSR.class 4KB
MsnMimeMessage.class 4KB
IncomingLST.class 4KB
AbstractSwitchboard.class 4KB
MsnftpMessageRecognizer.class 4KB
FileTransferWorker$1.class 4KB
DisplayPictureDuelManager.class 4KB
OutgoingADL.class 4KB
SSO$SSOticket.class 4KB
MsnGroupImpl.class 4KB
MsnEmailNotifyMessage.class 4KB
MsnP2PMessageFactory.class 4KB
IncomingADC.class 4KB
IncomingSYN.class 4KB
StringHolder.class 4KB
QName.class 4KB
MsnftpContent.class 4KB
MsnftpInviteMessage.class 3KB
FileTransferManager$SwitchboardListener.class 3KB
BasicMessenger$MessengerSessionListener.class 3KB
MsnEmailInitMessage.class 3KB
MsnEmoticonMessage.class 3KB
Session$1.class 3KB
IncomingREM.class 3KB
SimpleSwitchboard.class 3KB
MsnftpAcceptMessage.class 3KB
BasicSwitchboard$SBSessionListener.class 3KB
IncomingNLN.class 3KB
MsnInvitationMessageFactory.class 3KB
IncomingBPR.class 3KB
MsnFileDataMessage.class 3KB
IncomingILN.class 3KB
OutgoingUUX.class 3KB
XMLGregorianCalendar.class 3KB
IncomingRML.class 3KB
MsnEmailActivityMessage.class 3KB
FlowStore.class 3KB
MsnMessenger.class 3KB
DisplayPictureDuel$1.class 3KB
IncomingUBX.class 3KB
MsnP2PByeMessage.class 3KB
IncomingError.class 3KB
MsnP2PInvitationMessage.class 3KB
IncomingADD.class 3KB
SimpleMessenger$RateThread.class 3KB
MsnftpSession$1.class 3KB
MsnControlMessage.class 3KB
MsnftpSession.class 3KB
Session$MsgSender.class 3KB
AbstractFileTransfer.class 2KB
OutgoingCVR.class 2KB
IncomingCHG.class 2KB
MsnInvitationMessage.class 2KB
CopyOnWriteCollection.class 2KB
MsnUserImpl.class 2KB
MsnSystemMessage.class 2KB
共 558 条
- 1
- 2
- 3
- 4
- 5
- 6
zhu_ming
- 粉丝: 1
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论2