628 lines
15 KiB
C++
628 lines
15 KiB
C++
|
// IMm7MMSServiceEx.cpp: implementation of the IMm7MMSServiceEx class.
|
|||
|
//
|
|||
|
//////////////////////////////////////////////////////////////////////
|
|||
|
|
|||
|
#include "stdafx.h"
|
|||
|
#include "IMm7MMSServiceEx.h"
|
|||
|
|
|||
|
#include "..\FXSend.h"
|
|||
|
#include "..\FXSendDlg.h"
|
|||
|
|
|||
|
#ifdef _DEBUG
|
|||
|
#undef THIS_FILE
|
|||
|
static char THIS_FILE[]=__FILE__;
|
|||
|
#define new DEBUG_NEW
|
|||
|
#endif
|
|||
|
|
|||
|
//////////////////////////////////////////////////////////////////////
|
|||
|
// Construction/Destruction
|
|||
|
//////////////////////////////////////////////////////////////////////
|
|||
|
namespace IMm7MMS {
|
|||
|
|
|||
|
IMm7MMSServiceEx::IMm7MMSServiceEx()
|
|||
|
{
|
|||
|
m_pDlg = NULL;
|
|||
|
m_hThread = NULL;
|
|||
|
m_bStart = false;
|
|||
|
m_pSQL = NULL;
|
|||
|
m_Critical = NULL;
|
|||
|
m_lSQLCount=0;
|
|||
|
|
|||
|
m_bCopy = false;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
IMm7MMSServiceEx::~IMm7MMSServiceEx()
|
|||
|
{
|
|||
|
Web_Exit();
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
IMm7MMSServiceEx *IMm7MMSServiceEx::copy2()
|
|||
|
{
|
|||
|
|
|||
|
IMm7MMSServiceEx *dup = new IMm7MMSServiceEx();
|
|||
|
dup->destroy(); //<2F><><EFBFBD>취<EFBFBD><ECB7A8><EFBFBD><EFBFBD>Ϊcopy<70>Ḵ<EFBFBD><E1B8B4>һ<EFBFBD><D2BB>soap<61><70>ԭ<EFBFBD><D4AD><EFBFBD><EFBFBD>soap<61><70>Դ<EFBFBD><D4B4>Ҫ<EFBFBD><D2AA><EFBFBD>ͷ<EFBFBD>
|
|||
|
soap_copy_context(dup, this);
|
|||
|
|
|||
|
//<2F><><EFBFBD>Ʋ<EFBFBD><C6B2>ֲ<EFBFBD><D6B2><EFBFBD>
|
|||
|
dup->m_pDlg = this->m_pDlg;
|
|||
|
dup->m_strSQL_IP = this->m_strSQL_IP;
|
|||
|
dup->m_strSQL_User = this->m_strSQL_User;
|
|||
|
dup->m_strSQL_Passwd = this->m_strSQL_Passwd;
|
|||
|
dup->m_strSQL_DB = this->m_strSQL_DB;
|
|||
|
dup->m_strSQL_Provider = this->m_strSQL_Provider;
|
|||
|
|
|||
|
dup->m_pSQL = this->m_pSQL;
|
|||
|
dup->m_lSQLCount = this->m_lSQLCount;
|
|||
|
dup->m_Critical = this->m_Critical;
|
|||
|
|
|||
|
dup->m_bCopy = true; //<2F><><EFBFBD>⣬<EFBFBD><E2A3AC>ʶ<EFBFBD>Ǹ<EFBFBD><C7B8>Ƶ<EFBFBD><C6B5><EFBFBD>
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
//soap_set_mode(dup,SOAP_C_UTFSTRING);
|
|||
|
//dup->mode|=SOAP_C_UTFSTRING;
|
|||
|
|
|||
|
|
|||
|
|
|||
|
return dup;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
long IMm7MMSServiceEx::Web_Init(TCHAR * strIP, long lPort)
|
|||
|
{
|
|||
|
char * pIP = NULL;
|
|||
|
char szIP[64]={0};
|
|||
|
if ( strIP && _tcslen(strIP)>8 )
|
|||
|
{
|
|||
|
strcpy(szIP , CW2A(strIP));
|
|||
|
pIP = szIP;
|
|||
|
}
|
|||
|
if ( !soap_valid_socket(bind(pIP,lPort,100)) ) //100Ϊͬʱ<CDAC><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
{
|
|||
|
//soap_print_fault(&soap, stderr);
|
|||
|
return -1;
|
|||
|
}
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
soap_set_mode(this,SOAP_C_UTFSTRING);
|
|||
|
this->mode|=SOAP_C_UTFSTRING;
|
|||
|
|
|||
|
/*
|
|||
|
m_Critical = new CRITICAL_SECTION;
|
|||
|
InitializeCriticalSection(m_Critical);
|
|||
|
|
|||
|
m_lSQLCount = 10;
|
|||
|
|
|||
|
m_pSQL = new SQL_Pool[m_lSQLCount];
|
|||
|
for ( int i=0 ; i<m_lSQLCount ; i++ )
|
|||
|
{
|
|||
|
m_pSQL[i].bUse = false;
|
|||
|
m_pSQL[i].dwBeginUse = 0;
|
|||
|
m_pSQL[i].dwEndUse = 0;
|
|||
|
m_pSQL[i].lRandID = 0;
|
|||
|
//m_pSQL[i].spDoc = NULL;
|
|||
|
}
|
|||
|
*/
|
|||
|
|
|||
|
this->accept_timeout = 1000; //accept time out
|
|||
|
this->connect_timeout = 1000; //accept time out
|
|||
|
this->recv_timeout = 5000;
|
|||
|
this->send_timeout = 5000;
|
|||
|
|
|||
|
this->fget = Web_Get;
|
|||
|
this->fpost = Web_post;
|
|||
|
|
|||
|
DWORD ID=0;
|
|||
|
m_hThread = CreateThread( NULL , 0 , (LPTHREAD_START_ROUTINE)Process_AcceptT , (LPVOID)this , 0 , &ID );
|
|||
|
|
|||
|
|
|||
|
m_bStart = true;
|
|||
|
return 0;
|
|||
|
}
|
|||
|
|
|||
|
UINT IMm7MMSServiceEx::Process_AcceptT(LPVOID sParam)
|
|||
|
{
|
|||
|
|
|||
|
IMm7MMSServiceEx * pCtcc = (IMm7MMSServiceEx *)sParam;
|
|||
|
|
|||
|
|
|||
|
while(pCtcc->m_bStart)
|
|||
|
{
|
|||
|
SOAP_SOCKET s = pCtcc->accept();
|
|||
|
if (soap_valid_socket(s))
|
|||
|
{
|
|||
|
//fprintf(stderr,"Accepted connection from IP= %d.%d.%d.%d socket = %d ",
|
|||
|
// ((ServerSoap.ip)>>24)&&0xFF,((ServerSoap.ip)>>16)&0xFF,((ServerSoap.ip)>>8)&0xFF,(ServerSoap.ip)&0xFF,(ServerSoap.socket));
|
|||
|
|
|||
|
|
|||
|
IMm7MMSServiceEx * pNewCtcc = (IMm7MMSServiceEx *)pCtcc->copy2();
|
|||
|
|
|||
|
if ( pNewCtcc )
|
|||
|
{
|
|||
|
pNewCtcc->socket = s;
|
|||
|
QueueUserWorkItem(Process_Req, (PVOID)pNewCtcc, WT_EXECUTEDEFAULT); //WT_EXECUTELONGFUNCTION
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӳ<EFBFBD><D3B3><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
return 0;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
DWORD WINAPI IMm7MMSServiceEx::Process_Req(LPVOID lpParam)
|
|||
|
{
|
|||
|
IMm7MMSServiceEx * pCtcc = (IMm7MMSServiceEx *)lpParam;
|
|||
|
|
|||
|
|
|||
|
pCtcc->serve(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
soap_destroy(pCtcc);
|
|||
|
soap_end(pCtcc);
|
|||
|
soap_done(pCtcc);
|
|||
|
delete pCtcc;
|
|||
|
|
|||
|
return 0;
|
|||
|
}
|
|||
|
|
|||
|
IMm7MMSServiceEx::SQL_Pool * IMm7MMSServiceEx::GetBankSQL()
|
|||
|
{
|
|||
|
if ( !m_pSQL )
|
|||
|
return NULL;
|
|||
|
|
|||
|
for ( int j=0 ; j<10 ; j++ )
|
|||
|
{
|
|||
|
EnterCriticalSection(m_Critical);
|
|||
|
for ( int i=0 ; i<m_lSQLCount ; i++ )
|
|||
|
{
|
|||
|
if ( !m_pSQL[i].bUse && m_pSQL[i].lRandID==0 &&
|
|||
|
m_pSQL[i].adoConnection.isOK() )
|
|||
|
{
|
|||
|
m_pSQL[i].bUse = true;
|
|||
|
m_pSQL[i].lRandID = rand();
|
|||
|
m_pSQL[i].dwBeginUse = GetTickCount();
|
|||
|
//if ( !m_pSQL[i].spDoc )
|
|||
|
// m_pSQL[i].spDoc.CoCreateInstance(__uuidof(DOMDocument40));
|
|||
|
|
|||
|
if ( ConnectSQLServer(&m_pSQL[i]) ) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD>
|
|||
|
{
|
|||
|
|
|||
|
LeaveCriticalSection(m_Critical);
|
|||
|
return &m_pSQL[i];
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
LeaveCriticalSection(m_Critical);
|
|||
|
Sleep(500);
|
|||
|
}
|
|||
|
|
|||
|
return NULL;
|
|||
|
}
|
|||
|
|
|||
|
BOOL IMm7MMSServiceEx::ConnectSQLServer(IMm7MMSServiceEx::SQL_Pool *pSql)
|
|||
|
{
|
|||
|
if ( !pSql )
|
|||
|
return false;
|
|||
|
//if ( !pSql->spDoc )
|
|||
|
//{
|
|||
|
// pSql->spDoc.CoCreateInstance(__uuidof(DOMDocument40));
|
|||
|
//}
|
|||
|
if( pSql->adoConnection.IsOpen() )
|
|||
|
{
|
|||
|
return true;
|
|||
|
}
|
|||
|
|
|||
|
for ( int i=0 ; i<3; i++ ) //<2F><><EFBFBD><EFBFBD>3<EFBFBD>Σ<EFBFBD><CEA3><EFBFBD><EFBFBD>ܷ<EFBFBD><DCB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD>
|
|||
|
{
|
|||
|
BOOL b = pSql->adoConnection.ConnectSQLServer2(m_strSQL_IP,m_strSQL_DB,m_strSQL_User,m_strSQL_Passwd, m_strSQL_Provider);
|
|||
|
if ( b )
|
|||
|
{
|
|||
|
pSql->adoConnection.SetCommandTimeout(7200); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӳ<EFBFBD>ʱʱ<CAB1><CAB1>
|
|||
|
pSql->adoConnection.SetCursorLocation(adUseClient); //<2F><><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD>α<EFBFBD><CEB1><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
return true;
|
|||
|
}
|
|||
|
Sleep(2000);
|
|||
|
}
|
|||
|
|
|||
|
return false;
|
|||
|
}
|
|||
|
|
|||
|
void IMm7MMSServiceEx::SetSQLParam(CDialog * pDlg,CString strIP, CString strUser, CString strPasswd, CString strDB,CString strProvider)
|
|||
|
{
|
|||
|
m_pDlg = pDlg;
|
|||
|
m_strSQL_IP =strIP;
|
|||
|
m_strSQL_User=strUser;
|
|||
|
m_strSQL_Passwd=strPasswd;
|
|||
|
m_strSQL_DB=strDB;
|
|||
|
m_strSQL_Provider = strProvider;
|
|||
|
}
|
|||
|
|
|||
|
long IMm7MMSServiceEx::Web_Exit()
|
|||
|
{
|
|||
|
if ( m_bCopy ) //<2F><><EFBFBD><EFBFBD>ֻ<EFBFBD>Ǹ<EFBFBD><C7B8>Ƶģ<C6B5><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD>Դ<EFBFBD><D4B4>
|
|||
|
return true;
|
|||
|
|
|||
|
m_bStart = false;
|
|||
|
if ( m_hThread != INVALID_HANDLE_VALUE)
|
|||
|
{
|
|||
|
soap_destroy(this);
|
|||
|
soap_end(this);
|
|||
|
soap_done(this);
|
|||
|
|
|||
|
WaitForSingleObject(m_hThread , 10000 ); //<2F>ȴ<EFBFBD>10<31><30>
|
|||
|
|
|||
|
m_hThread = INVALID_HANDLE_VALUE;
|
|||
|
}
|
|||
|
|
|||
|
if ( m_pSQL )
|
|||
|
{
|
|||
|
EnterCriticalSection(m_Critical);
|
|||
|
for (int i=0 ; i<m_lSQLCount ; i++ )
|
|||
|
{
|
|||
|
m_pSQL[i].adoConnection.Close();
|
|||
|
//if ( m_pSQL[i].spDoc )
|
|||
|
//{
|
|||
|
// m_pSQL[i].spDoc.Release();
|
|||
|
// m_pSQL[i].spDoc = NULL;
|
|||
|
//}
|
|||
|
}
|
|||
|
delete []m_pSQL;
|
|||
|
m_pSQL=NULL;
|
|||
|
LeaveCriticalSection(m_Critical);
|
|||
|
}
|
|||
|
|
|||
|
if ( m_Critical )
|
|||
|
{
|
|||
|
DeleteCriticalSection(m_Critical);
|
|||
|
delete m_Critical;
|
|||
|
m_Critical = NULL;
|
|||
|
}
|
|||
|
return true;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
int IMm7MMSServiceEx::Web_post(struct soap *soap, const char *endpoint, const char *host, int port,const char *path, const char *action, size_t count)
|
|||
|
{
|
|||
|
return Web_Get( soap ); // <20><EFBFBD><F2B5A5B4><EFBFBD><EFBFBD><EFBFBD>ֱ<EFBFBD>ӵ<EFBFBD><D3B5><EFBFBD>http_get
|
|||
|
}
|
|||
|
int IMm7MMSServiceEx::Web_Get(struct soap* soap)
|
|||
|
{
|
|||
|
// <20><><EFBFBD><EFBFBD>WSDLʱ<4C><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD>ļ<EFBFBD>
|
|||
|
// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>wsdl<64>ļ<EFBFBD><C4BC><EFBFBD>
|
|||
|
CString fielPath(soap->path);
|
|||
|
fielPath.MakeUpper();
|
|||
|
CStringA strRet;
|
|||
|
strRet = " <HTML> MobsetApi WebServices! </HTML> ";
|
|||
|
if ( fielPath.Find(_T("WSDL"))>0 )
|
|||
|
{
|
|||
|
TCHAR RootDirectory[_MAX_PATH]={0};
|
|||
|
GetCurrentPath(RootDirectory);
|
|||
|
CString strFileName = CString(RootDirectory)+CString(_T("\\IMm7MMSService.wsdl"));
|
|||
|
|
|||
|
CFile file;
|
|||
|
if ( file.Open(strFileName , CFile::modeRead) )
|
|||
|
{
|
|||
|
char * p = new char[file.GetLength()];
|
|||
|
memset(p , 0 , file.GetLength());
|
|||
|
file.Read(p , file.GetLength());
|
|||
|
|
|||
|
|
|||
|
CStringA str(p,file.GetLength());
|
|||
|
file.Close();
|
|||
|
|
|||
|
strRet = str;
|
|||
|
|
|||
|
//return 404;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
soap_response(soap, SOAP_HTML);
|
|||
|
|
|||
|
soap_send(soap, strRet );
|
|||
|
|
|||
|
soap_end_send(soap);
|
|||
|
|
|||
|
return SOAP_OK;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
void IMm7MMSServiceEx::GetCurrentPath(TCHAR *pPath)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
::GetModuleFileName( NULL , pPath , 512);
|
|||
|
int j=lstrlen(pPath);
|
|||
|
for ( ; j>0 ; j-- )
|
|||
|
{
|
|||
|
if (pPath[j]=='\\' )
|
|||
|
break;
|
|||
|
}
|
|||
|
pPath[j+1]=0;
|
|||
|
}
|
|||
|
catch(...)
|
|||
|
{
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
int mm7SoapBindingService::submitReq(ns1__submitReqType *ns1__SubmitReq, ns1__submitRspType *ns1__SubmitRsp)
|
|||
|
{
|
|||
|
return 0;
|
|||
|
}
|
|||
|
int mm7SoapBindingService::deliverReq(ns1__deliverReqType *ns1__DeliverReq, ns1__deliverRspType *ns1__DeliverRsp)
|
|||
|
{
|
|||
|
return 0;
|
|||
|
}
|
|||
|
int mm7SoapBindingService::deliveryReportReq(ns1__deliveryReportReqType *ns1__DeliveryReportReq, ns1__genericResponseType *ns1__DeliveryReportRsp)
|
|||
|
{
|
|||
|
return 0;
|
|||
|
}
|
|||
|
int IMm7MMSServiceEx::submitReq(ns1__submitReqType *ns1__SubmitReq, ns1__submitRspType *ns1__SubmitRsp)
|
|||
|
{
|
|||
|
return 0;
|
|||
|
}
|
|||
|
BOOL IMm7MMSServiceEx::InsertMms(FZ_Send & mms,RecvSms_MmsAttach & mmsAttach,soap_multipart::iterator attachment)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
BYTE * pData = (BYTE*)(*attachment).ptr;
|
|||
|
long lSize = (*attachment).size;
|
|||
|
long lEncoding = (*attachment).encoding;
|
|||
|
CString strType = ((*attachment).type?(*attachment).type:"");
|
|||
|
CString strID = ((*attachment).id?(*attachment).id:"");
|
|||
|
CString strLocation = ((*attachment).location?(*attachment).location:"");
|
|||
|
CString strDescription = ((*attachment).description?(*attachment).description:"");
|
|||
|
|
|||
|
|
|||
|
//<2F><><EFBFBD>Ƹ<EFBFBD><C6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
mmsAttach.lSize = lSize;
|
|||
|
mmsAttach.pData = new BYTE[lSize];
|
|||
|
memcpy(mmsAttach.pData , pData , lSize );
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
CString strName=strLocation;
|
|||
|
if ( strName.Find(_T("."))<0 && strID.GetLength()>0)
|
|||
|
strName = strID;
|
|||
|
strName.Replace(_T(">") , _T("") );
|
|||
|
strName.Replace(_T("<") , _T("") );
|
|||
|
_tcsncpy(mmsAttach.szID , strID,sizeof(mmsAttach.szID)/sizeof(TCHAR)-1 );
|
|||
|
_tcsncpy(mmsAttach.szName , strName,sizeof(mmsAttach.szName)/sizeof(TCHAR)-1 );
|
|||
|
_tcsncpy(mmsAttach.szType , strType,sizeof(mmsAttach.szType)/sizeof(TCHAR)-1 );
|
|||
|
_tcsncpy(mmsAttach.szLocation , strLocation,sizeof(mmsAttach.szLocation)/sizeof(TCHAR)-1 );
|
|||
|
|
|||
|
mms.lmmSize += lSize;
|
|||
|
|
|||
|
return true;
|
|||
|
}
|
|||
|
catch(...)
|
|||
|
{
|
|||
|
}
|
|||
|
return false;
|
|||
|
}
|
|||
|
int IMm7MMSServiceEx::deliverReq(ns1__deliverReqType *ns1__DeliverReq, ns1__deliverRspType *ns1__DeliverRsp)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
ns1__DeliverRsp->MM7Version = ns1__versionType__6_x002e3_x002e0;
|
|||
|
ns1__DeliverRsp->Status = soap_new_ns1__responseStatusType(this,-1);
|
|||
|
ns1__DeliverRsp->Status->StatusCode = L"1000";
|
|||
|
ns1__DeliverRsp->Status->StatusText = L"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>";
|
|||
|
|
|||
|
CString strID;
|
|||
|
if ( ns1__DeliverReq->LinkedID )
|
|||
|
strID=ns1__DeliverReq->LinkedID->c_str();
|
|||
|
|
|||
|
CString strMobile;
|
|||
|
if (ns1__DeliverReq->Sender && ns1__DeliverReq->Sender->__item)
|
|||
|
strMobile=ns1__DeliverReq->Sender->__item;
|
|||
|
|
|||
|
CString strRecvNum;
|
|||
|
try
|
|||
|
{
|
|||
|
if ( ns1__DeliverReq->Recipients && ns1__DeliverReq->Recipients->__size_recipientsType_sequence>0 )
|
|||
|
{
|
|||
|
for ( int i=0 ; i<ns1__DeliverReq->Recipients->__size_recipientsType_sequence ; i++ )
|
|||
|
{
|
|||
|
__ns1__recipientsType_sequence * pSeq = &ns1__DeliverReq->Recipients->__recipientsType_sequence[i];
|
|||
|
if ( pSeq && pSeq->union_recipientsType.To )
|
|||
|
{
|
|||
|
if ( pSeq->union_recipientsType.To->__size_multiAddressType_sequence >0 )
|
|||
|
{
|
|||
|
strRecvNum = pSeq->union_recipientsType.To->__multiAddressType_sequence->union_multiAddressType.Number->__item.c_str();
|
|||
|
if ( strRecvNum.GetLength()>3 )
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
catch(...)
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
CString strSubject;
|
|||
|
if ( ns1__DeliverReq->Subject )
|
|||
|
strSubject = ns1__DeliverReq->Subject->c_str();
|
|||
|
|
|||
|
/*
|
|||
|
const CStringA utf8 = CW2A(unicode1, CP_UTF8);
|
|||
|
ASSERT(utf8.GetLength() > unicode1.GetLength());
|
|||
|
const CStringW unicode2 = CA2W(utf8, CP_UTF8);
|
|||
|
ASSERT(unicode1 == unicode2);
|
|||
|
*/
|
|||
|
|
|||
|
//CFXSendDlg::ConvertUtf8ToGBK(strSubject); //ת<><D7AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
FZ_Send mms={0};
|
|||
|
_tcscpy(mms.szSendNum , strMobile);
|
|||
|
_tcscpy(mms.Mobile[0].szMobile, strRecvNum);
|
|||
|
_tcscpy(mms.szMsg , strSubject );
|
|||
|
mms.lMmsAttach = 20;//Ĭ<><C4AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>20<32><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
/*
|
|||
|
//<2F>ҳ<EFBFBD><D2B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
for (soap_multipart::iterator attachment = ns1__DeliverReq->soap->mime.begin(); attachment != ns1__DeliverReq->soap->mime.end(); ++attachment)
|
|||
|
{
|
|||
|
BYTE * pData = (BYTE*)(*attachment).ptr;
|
|||
|
long lSize = (*attachment).size;
|
|||
|
|
|||
|
if ( pData>0 && lSize>0 )
|
|||
|
{
|
|||
|
mms.lMmsAttach ++;
|
|||
|
}
|
|||
|
}
|
|||
|
*/
|
|||
|
mms.pMmsAttach = new RecvSms_MmsAttach[mms.lMmsAttach];
|
|||
|
memset(mms.pMmsAttach , 0 , sizeof(RecvSms_MmsAttach)*mms.lMmsAttach );
|
|||
|
|
|||
|
long lIndex = 0;
|
|||
|
for (soap_multipart::iterator attachment = ns1__DeliverReq->soap->mime.begin(); attachment != ns1__DeliverReq->soap->mime.end(); ++attachment)
|
|||
|
{
|
|||
|
BYTE * pData = (BYTE*)(*attachment).ptr;
|
|||
|
long lSize = (*attachment).size;
|
|||
|
if ( pData>0 && lSize>0 )
|
|||
|
{
|
|||
|
BOOL bSubAttach=false;
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD>ΪС<CEAA><D0A1>65K<35><4B><EFBFBD>ݵĶ<DDB5>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Mime<6D><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>65K<35><4B><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ķ<EFBFBD><C4B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>£<EFBFBD>
|
|||
|
//1<><31><EFBFBD>½<EFBFBD>frecv<63><76><EFBFBD><EFBFBD><EFBFBD><EFBFBD>//size_t (*frecv)(struct soap*, char*, size_t);
|
|||
|
//2<><32><EFBFBD>滻psoap->frecv<63><76><EFBFBD><EFBFBD>
|
|||
|
//3<><33><EFBFBD><EFBFBD>frecv<63><76><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9>pdata<74><61>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
|
|||
|
if ( lSize<SOAP_BUFLEN)
|
|||
|
{
|
|||
|
soap * psoap2 = this;
|
|||
|
//soap * psoap = SOAP_NEW(soap);
|
|||
|
//soap * psoap = soap_copy(this);
|
|||
|
soap * psoap = new soap;
|
|||
|
//memset(psoap,0,sizeof(soap));
|
|||
|
psoap->bufidx=0;
|
|||
|
psoap->buflen = lSize;
|
|||
|
psoap->mode|= SOAP_ENC_MIME;
|
|||
|
memcpy(psoap->buf,pData,lSize);
|
|||
|
soap_getmime(psoap);
|
|||
|
psoap->mime.list = psoap->mime.first;
|
|||
|
psoap->mime.first = NULL;
|
|||
|
psoap->mime.last = NULL;
|
|||
|
psoap->mime.boundary = NULL;
|
|||
|
/*
|
|||
|
if (psoap->xlist)
|
|||
|
{ struct soap_multipart *content;
|
|||
|
for (content = psoap->mime.list; content; content = content->next)
|
|||
|
soap_resolve_attachment(psoap, content);
|
|||
|
}
|
|||
|
*/
|
|||
|
for (soap_multipart::iterator attachment21 = psoap->mime.begin(); attachment21 != psoap->mime.end(); ++attachment21)
|
|||
|
{
|
|||
|
InsertMms(mms,mms.pMmsAttach[lIndex],attachment21);
|
|||
|
|
|||
|
bSubAttach = true;
|
|||
|
lIndex ++;
|
|||
|
if (lIndex>=mms.lMmsAttach ) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
{
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
soap_destroy(psoap);
|
|||
|
soap_end(psoap);
|
|||
|
soap_done(psoap);
|
|||
|
delete psoap;
|
|||
|
}
|
|||
|
if ( !bSubAttach)
|
|||
|
{
|
|||
|
lIndex ++;
|
|||
|
InsertMms(mms,mms.pMmsAttach[lIndex],attachment);
|
|||
|
}
|
|||
|
|
|||
|
if (lIndex>=mms.lMmsAttach ) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
{
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
mms.lMmsAttach = lIndex; //<2F><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
if ( m_pDlg )
|
|||
|
((CFXSendDlg*)m_pDlg)->Public_RecvSms_Add(mms); //<2F><><EFBFBD>뷵<EFBFBD><EBB7B5><EFBFBD>б<EFBFBD>
|
|||
|
|
|||
|
}
|
|||
|
catch(...)
|
|||
|
{
|
|||
|
}
|
|||
|
//Sleep(10000);
|
|||
|
return 0;
|
|||
|
}
|
|||
|
|
|||
|
int IMm7MMSServiceEx::deliveryReportReq(ns1__deliveryReportReqType *ns1__DeliveryReportReq, ns1__genericResponseType *ns1__DeliveryReportRsp)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
ns1__DeliveryReportRsp->MM7Version = ns1__versionType__6_x002e3_x002e0;
|
|||
|
ns1__DeliveryReportRsp->Status = soap_new_ns1__responseStatusType(this,-1);
|
|||
|
ns1__DeliveryReportRsp->Status->StatusCode = L"1000";
|
|||
|
ns1__DeliveryReportRsp->Status->StatusText = L"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>";
|
|||
|
|
|||
|
CString strID;
|
|||
|
strID = ns1__DeliveryReportReq->MessageID.c_str();
|
|||
|
|
|||
|
CString strMobile;
|
|||
|
if ( ns1__DeliveryReportReq->Recipient->__size_multiAddressType_sequence>0 && ns1__DeliveryReportReq->Recipient->__multiAddressType_sequence)
|
|||
|
{
|
|||
|
//strMobile = ns1__DeliveryReportReq->Recipient->__multiAddressType_sequence->union_multiAddressType.Number->__item.c_str();
|
|||
|
__ns1__multiAddressType_sequence * pSeq = &ns1__DeliveryReportReq->Recipient->__multiAddressType_sequence[0];
|
|||
|
if ( pSeq && pSeq->union_multiAddressType.Number )
|
|||
|
{
|
|||
|
strMobile = pSeq->union_multiAddressType.Number->__item.c_str();
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
CString strStatus=_T("unknow");
|
|||
|
switch(ns1__DeliveryReportReq->MMStatus)
|
|||
|
{
|
|||
|
case ns1__mmDeliveryStatusType__Expired:
|
|||
|
strStatus=_T("Expired");
|
|||
|
break;
|
|||
|
case ns1__mmDeliveryStatusType__Retrieved:
|
|||
|
strStatus=_T("Retrieved");
|
|||
|
break;
|
|||
|
case ns1__mmDeliveryStatusType__Indeterminate:
|
|||
|
strStatus=_T("Indeterminate");
|
|||
|
break;
|
|||
|
case ns1__mmDeliveryStatusType__Forwarded:
|
|||
|
strStatus=_T("Forwarded");
|
|||
|
break;
|
|||
|
}
|
|||
|
|
|||
|
MT_Report report2={0};
|
|||
|
_tcscpy(report2.szMsgID , strID );
|
|||
|
_tcscpy(report2.szMobile , strMobile );
|
|||
|
_tcscpy(report2.szStatus , strStatus );
|
|||
|
|
|||
|
if ( strStatus == CString(_T("Retrieved")) || strStatus.GetLength()<=0 )
|
|||
|
{
|
|||
|
report2.lReportOK = 1;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
report2.lReportOK = 0;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
if ( m_pDlg )
|
|||
|
((CFXSendDlg*)m_pDlg)->Public_Report_Add(report2); //<2F><><EFBFBD>뷵<EFBFBD><EBB7B5><EFBFBD>б<EFBFBD>
|
|||
|
|
|||
|
}
|
|||
|
catch(...)
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
return 0;
|
|||
|
}
|
|||
|
|
|||
|
};
|
|||
|
|
|||
|
|