Problem with calling web service using HTTPSendRequest and InternetReadFile on EVC 3.0.
-
I am trying to call a web service on Pocket PC (ARM processor) using HTTPSendRequest. But when doing InternetReadFile it is giving me incomplete string like this
-
I am trying to call a web service on Pocket PC (ARM processor) using HTTPSendRequest. But when doing InternetReadFile it is giving me incomplete string like this
I got such incomplete information after calling this web service 2 to 3 times. Initially 2 times i got blank reply. Now When I used HTTPQueryInfo it showed following message H T T P / 1 . 1 4 0 0 B a d R e q u e s t S e r v e r : M i c r o s o f t - I I S / 5 . 0 D a t e : F r i , 2 8 S e p 2 0 0 7 0 8 : 3 5 : 5 1 G M T X - P o w e r e d - B y : A S P . N E T X - A s p N e t - V e r s i o n : 2 . 0 . 5 0 7 2 7 C a c h e - C o n t r o l : p r i v a t e C o n t e n t - L e n g t h : 0 My web service contains just one method “HelloWorld” which does not take any input parameters and returns the “HelloWorld” string to the calling application. My code of calling web service is following. LPTSTR AcceptTypes[2] = {TEXT("text/xml"), NULL}; DWORD dwFlags = INTERNET_FLAG_NO_CACHE_WRITE |INTERNET_FLAG_KEEP_CONNECTION; HINTERNET hNet = InternetOpen(L"EvcWebService", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0 ); if (hNet) { HINTERNET hSession = InternetConnect(hNet, _T("10.37.54.93"), INTERNET_DEFAULT_HTTP_PORT, _T(""), _T(""), INTERNET_SERVICE_HTTP, 0, 0); if (hSession) { HINTERNET hRequest = HttpOpenRequest(hSession, _T("POST"), _T("/TestService/Service.asmx?wsdl"), TEXT("HTTP/1.1"),NULL, (LPCTSTR*)AcceptTypes, dwFlags, 0); if (hRequest) { TCHAR szSoapAction[256]; _tcscpy( szSoapAction, _T("Content-Type: text/xml;charset=utf-8\n") ); _tcscat( szSoapAction, _T("SOAPAction: \"") ); _tcscat( szSoapAction, _T("http://tempuri.org/HelloWorld") ); _tcscat( szSoapAction , _T("\"\0\r\n\r\n") ); TCHAR szSoap[512]; _tcscpy(pszSoap, _T("") ); _tcscat(pszSoap, _T("") ); _tcscat(pszSoap, _T("") ); _tcscat(pszSoap, _T("") ); _tcscat(pszSoap, _T("") ); _tcscat(pszSoap, _T("") ); // _tcscat(pszSoap, _T("") ); _tcscat(pszSoap, _T("") ); _tcscat(pszSoap, _T("") ); BOOL bSent = HttpSendRequest(hRequest, szSoapAction, _tcslen(szSoapAction), szSoap, _tcslen(szSoap) ); if(bSent) { called HTTPQueryInfo..... } This HTTPQueryInfo returns bad request. But this code works fine on Win32 and give Bad Request on WinCE. Please let me know how should i b