Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. IXMLHttpRequest sending request?

IXMLHttpRequest sending request?

Scheduled Pinned Locked Moved C / C++ / MFC
xmlwcfsysadminhelpquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    ritz1234
    wrote on last edited by
    #1

    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

    V 1 Reply Last reply
    0
    • R 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

      V Offline
      V Offline
      vikas amin
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups