IXMLHttpRequest sending request?
-
Hello friends, I've an IE Toolbar with VC 6.0. I am calling a webservice from the application which result in HTTP 400 i.e "Bad Request".However calling webservice works for the first time successfully but after that whenever I call the webservice it results in "Bad Request".If I close the browser and reopen it will work again for one time only, Can anybody tell me what could be the problem?
vRequest.vt = VT_BSTR;
vRequest.bstrVal = szRequest.AllocSysString();MSXML::IXMLHttpRequestPtr httpReq( \_uuidof(XMLHTTPRequest)); HTTPMethod = \_bstr\_t("POST"); //httpReq->open(HTTPMethod ,"http://localhost/common/webservicedownload.asmx",noAsync,vtMissing,vtMissing); httpReq->open(HTTPMethod ,SERVER\_URL,noAsync,vtMissing,vtMissing); httpReq->setRequestHeader("Content-Type","application/soap+xml"); HRESULT hr=httpReq->send(vRequest); if (httpReq->readyState == 4 ) { if(httpReq->status==200) { bsResponse = httpReq->responseText; } else { \_bstr\_t strline=httpReq->statusText; CString strstatus; strstatus=strline.copy(); MessageBox(strstatus); } } response.Empty(); response=bsResponse.copy();
I parse the response for getting the "true" or "false" value. I get the correct response for the first time but after that the response is empty and statusText result in "Bad Request".
ritz1234
-
Hello friends, I've an IE Toolbar with VC 6.0. I am calling a webservice from the application which result in HTTP 400 i.e "Bad Request".However calling webservice works for the first time successfully but after that whenever I call the webservice it results in "Bad Request".If I close the browser and reopen it will work again for one time only, Can anybody tell me what could be the problem?
vRequest.vt = VT_BSTR;
vRequest.bstrVal = szRequest.AllocSysString();MSXML::IXMLHttpRequestPtr httpReq( \_uuidof(XMLHTTPRequest)); HTTPMethod = \_bstr\_t("POST"); //httpReq->open(HTTPMethod ,"http://localhost/common/webservicedownload.asmx",noAsync,vtMissing,vtMissing); httpReq->open(HTTPMethod ,SERVER\_URL,noAsync,vtMissing,vtMissing); httpReq->setRequestHeader("Content-Type","application/soap+xml"); HRESULT hr=httpReq->send(vRequest); if (httpReq->readyState == 4 ) { if(httpReq->status==200) { bsResponse = httpReq->responseText; } else { \_bstr\_t strline=httpReq->statusText; CString strstatus; strstatus=strline.copy(); MessageBox(strstatus); } } response.Empty(); response=bsResponse.copy();
I parse the response for getting the "true" or "false" value. I get the correct response for the first time but after that the response is empty and statusText result in "Bad Request".
ritz1234
It seems like you are not closing the connection and trying to reconnect to the service .
Vikas Amin
My First Article on CP" Virtual Serial Port "[^]
modified on Thursday, July 24, 2008 5:33 PM