555 lines
12 KiB
C++
555 lines
12 KiB
C++
|
// IagwMmsServiceEx.cpp: implementation of the IagwMmsServiceEx class.
|
|||
|
//
|
|||
|
//////////////////////////////////////////////////////////////////////
|
|||
|
|
|||
|
#include "stdafx.h"
|
|||
|
#include "IagwMmsServiceEx.h"
|
|||
|
|
|||
|
#include "..\FXSend.h"
|
|||
|
#include "..\FXSendDlg.h"
|
|||
|
|
|||
|
#ifdef _DEBUG
|
|||
|
#undef THIS_FILE
|
|||
|
static char THIS_FILE[]=__FILE__;
|
|||
|
#define new DEBUG_NEW
|
|||
|
#endif
|
|||
|
|
|||
|
//////////////////////////////////////////////////////////////////////
|
|||
|
// Construction/Destruction
|
|||
|
//////////////////////////////////////////////////////////////////////
|
|||
|
#include "../../../public/CMarkup/Markup.h"
|
|||
|
|
|||
|
namespace IAGWMMS {
|
|||
|
|
|||
|
IagwMmsServiceEx::IagwMmsServiceEx()
|
|||
|
{
|
|||
|
m_pDlg = NULL;
|
|||
|
m_hThread = NULL;
|
|||
|
m_bStart = false;
|
|||
|
m_pSQL = NULL;
|
|||
|
m_Critical = NULL;
|
|||
|
m_lSQLCount=0;
|
|||
|
|
|||
|
m_bCopy = false;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
IagwMmsServiceEx::~IagwMmsServiceEx()
|
|||
|
{
|
|||
|
Web_Exit();
|
|||
|
}
|
|||
|
|
|||
|
int capServiceSoapBindingService::ExecuteInvoke(std::wstring ns1__requsetXml, std::wstring &ns1__ExecuteInvokeReturn)
|
|||
|
{
|
|||
|
return 0;
|
|||
|
}
|
|||
|
|
|||
|
int capServiceSoapBindingService::EncodeString(std::wstring ns1__decode, std::wstring &ns1__EncodeStringReturn)
|
|||
|
{
|
|||
|
return 0;
|
|||
|
}
|
|||
|
|
|||
|
int IagwMmsServiceEx::ExecuteInvoke(std::wstring ns1__requsetXml, std::wstring &ns1__ExecuteInvokeReturn)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
if ( ns1__requsetXml.c_str())
|
|||
|
{
|
|||
|
CString strReqXml = ns1__requsetXml.c_str();
|
|||
|
CMarkup xml(strReqXml);
|
|||
|
|
|||
|
if ( xml.FindElem(_T("/Package/ParamItems")) && xml.IntoElem())
|
|||
|
{
|
|||
|
CString SendAddress,MsgId,ReturnType,Status,Subject,AccessCode;
|
|||
|
while ( xml.FindElem( _T("ParamItem") ) )
|
|||
|
{
|
|||
|
//xml.IntoElem();
|
|||
|
CString ParamID,ParamValue;
|
|||
|
if ( xml.FindChildElem( _T("ParamID") ) )
|
|||
|
{
|
|||
|
xml.IntoElem();
|
|||
|
ParamID = xml.GetData();
|
|||
|
xml.OutOfElem();
|
|||
|
xml.ResetChildPos();
|
|||
|
}
|
|||
|
|
|||
|
if ( xml.FindChildElem( _T("ParamValue") ) )
|
|||
|
{
|
|||
|
xml.IntoElem();
|
|||
|
ParamValue = xml.GetData();
|
|||
|
xml.OutOfElem();
|
|||
|
xml.ResetChildPos();
|
|||
|
}
|
|||
|
|
|||
|
if ( ParamID == CString(_T("SendAddress")))
|
|||
|
{
|
|||
|
SendAddress = ParamValue;
|
|||
|
SendAddress.MakeLower();
|
|||
|
SendAddress.Replace(_T("tel:") , _T(""));
|
|||
|
}
|
|||
|
if ( ParamID == CString(_T("MsgId")))
|
|||
|
{
|
|||
|
MsgId = ParamValue;
|
|||
|
}
|
|||
|
if ( ParamID == CString(_T("ReturnType")))
|
|||
|
{
|
|||
|
ReturnType = ParamValue;
|
|||
|
}
|
|||
|
if ( ParamID == CString(_T("Status")))
|
|||
|
{
|
|||
|
Status = ParamValue;
|
|||
|
}
|
|||
|
if ( ParamID == CString(_T("Subject")))
|
|||
|
{
|
|||
|
Subject = ParamValue;
|
|||
|
}
|
|||
|
if ( ParamID == CString(_T("AccessCode")))
|
|||
|
{
|
|||
|
AccessCode = ParamValue;
|
|||
|
}
|
|||
|
}
|
|||
|
//<2F><><EFBFBD><EFBFBD>״̬<D7B4><CCAC><EFBFBD><EFBFBD>
|
|||
|
if (ReturnType == CString(_T("Receipt")) ) //<2F><>״̬<D7B4><CCAC><EFBFBD><EFBFBD>
|
|||
|
{
|
|||
|
MT_Report report2={0};
|
|||
|
//FZ_Send send={0};
|
|||
|
//send.lReSendCount = -1234; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
_tcscpy(report2.szMsgID , MsgId );
|
|||
|
_tcscpy(report2.szMobile , SendAddress );
|
|||
|
_tcscpy(report2.szStatus , Status );
|
|||
|
|
|||
|
//if ( (Status==CString(_T("DeliveryImpossible")) || Status == CString(_T("DELIVRD")) ) || Status.GetLength()<=0 )
|
|||
|
if ( (Status==CString(_T("DeliveredToTerminal")) || Status == CString(_T("DELIVRD")) ) || Status.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>
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
//<2F><><EFBFBD><EFBFBD>״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܻ<EFBFBD><DCBB>ǽ<EFBFBD><C7BD>յ<EFBFBD><D5B5><EFBFBD><EFBFBD>в<EFBFBD><D0B2>ţ<EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
|
|||
|
if ( Subject.GetLength()>=0 || AccessCode.GetLength()>=0 )
|
|||
|
{
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD><D0B2><EFBFBD>
|
|||
|
FZ_Send mms={0};
|
|||
|
_tcscpy(mms.szSendNum , SendAddress);
|
|||
|
_tcscpy(mms.Mobile[0].szMobile, AccessCode);
|
|||
|
_tcscpy(mms.szMsg , Subject );
|
|||
|
|
|||
|
mms.lMmsAttach = 0;
|
|||
|
//<2F>ҳ<EFBFBD><D2B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
for (soap_multipart::iterator attachment = mime.begin(); attachment != 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 attachment2 = mime.begin(); attachment2 != mime.end(); ++attachment2)
|
|||
|
{
|
|||
|
BYTE * pData = (BYTE*)(*attachment2).ptr;
|
|||
|
long lSize = (*attachment2).size;
|
|||
|
|
|||
|
|
|||
|
long lEncoding = (*attachment2).encoding;
|
|||
|
CString strType = ((*attachment2).type?(*attachment2).type:"");
|
|||
|
CString strID = ((*attachment2).id?(*attachment2).id:"");
|
|||
|
CString strLocation = ((*attachment2).location?(*attachment2).location:"");
|
|||
|
CString strDescription = ((*attachment2).description?(*attachment2).description:"");
|
|||
|
|
|||
|
if ( pData>0 && lSize>0 )
|
|||
|
{
|
|||
|
//<2F><><EFBFBD>Ƹ<EFBFBD><C6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
mms.pMmsAttach[lIndex].lSize = lSize;
|
|||
|
mms.pMmsAttach[lIndex].pData = new BYTE[lSize];
|
|||
|
memcpy(mms.pMmsAttach[lIndex].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("") );
|
|||
|
_tcscpy(mms.pMmsAttach[lIndex].szID , strID );
|
|||
|
_tcscpy(mms.pMmsAttach[lIndex].szName , strName );
|
|||
|
_tcscpy(mms.pMmsAttach[lIndex].szType , strType );
|
|||
|
_tcscpy(mms.pMmsAttach[lIndex].szLocation , strLocation );
|
|||
|
|
|||
|
|
|||
|
mms.lmmSize += lSize;
|
|||
|
|
|||
|
lIndex ++;
|
|||
|
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>
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
CString strRet=_T("<?xml version=\"1.0\" encoding=\"utf-8\"?>")\
|
|||
|
_T("<Package>")\
|
|||
|
_T("<TimeStamp>%s</TimeStamp>")\
|
|||
|
_T("<TransactionID>%s</TransactionID>")\
|
|||
|
_T("<ResultCode>0000</ResultCode>")\
|
|||
|
_T("<ResultMsg>Sucess</ResultMsg>")\
|
|||
|
_T("<Status>3</Status>")\
|
|||
|
_T("</Package>");
|
|||
|
|
|||
|
CString TimeStamp;
|
|||
|
SYSTEMTIME t;GetSystemTime(&t);
|
|||
|
TimeStamp.Format(_T("%04d%02d%02d%02d%02d%02d%03d"),t.wYear,t.wMonth,t.wDay,t.wHour,t.wMinute,t.wSecond,t.wMilliseconds);
|
|||
|
|
|||
|
CString strRet2;
|
|||
|
strRet2.Format(strRet,TimeStamp,TimeStamp);
|
|||
|
|
|||
|
ns1__ExecuteInvokeReturn = strRet2;
|
|||
|
}
|
|||
|
}
|
|||
|
catch(...)
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
return 0;
|
|||
|
}
|
|||
|
|
|||
|
int IagwMmsServiceEx::EncodeString(std::wstring ns1__decode, std::wstring &ns1__EncodeStringReturn)
|
|||
|
{
|
|||
|
return 0;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
IagwMmsServiceEx *IagwMmsServiceEx::copy2()
|
|||
|
{
|
|||
|
|
|||
|
IagwMmsServiceEx *dup = new IagwMmsServiceEx();
|
|||
|
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 IagwMmsServiceEx::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;
|
|||
|
|
|||
|
|
|||
|
DWORD ID=0;
|
|||
|
m_hThread = CreateThread( NULL , 0 , (LPTHREAD_START_ROUTINE)Process_AcceptT , (LPVOID)this , 0 , &ID );
|
|||
|
|
|||
|
|
|||
|
m_bStart = true;
|
|||
|
return 0;
|
|||
|
}
|
|||
|
|
|||
|
UINT IagwMmsServiceEx::Process_AcceptT(LPVOID sParam)
|
|||
|
{
|
|||
|
|
|||
|
IagwMmsServiceEx * pCtcc = (IagwMmsServiceEx *)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));
|
|||
|
|
|||
|
|
|||
|
IagwMmsServiceEx * pNewCtcc = (IagwMmsServiceEx *)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 IagwMmsServiceEx::Process_Req(LPVOID lpParam)
|
|||
|
{
|
|||
|
IagwMmsServiceEx * pCtcc = (IagwMmsServiceEx *)lpParam;
|
|||
|
|
|||
|
|
|||
|
pCtcc->serve(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
soap_destroy(pCtcc);
|
|||
|
soap_end(pCtcc);
|
|||
|
soap_done(pCtcc);
|
|||
|
delete pCtcc;
|
|||
|
|
|||
|
return 0;
|
|||
|
}
|
|||
|
|
|||
|
IagwMmsServiceEx::SQL_Pool * IagwMmsServiceEx::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 IagwMmsServiceEx::ConnectSQLServer(IagwMmsServiceEx::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 IagwMmsServiceEx::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 IagwMmsServiceEx::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 IagwMmsServiceEx::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 IagwMmsServiceEx::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("\\IagwMmsService.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 IagwMmsServiceEx::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(...)
|
|||
|
{
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
};
|