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. Windows API
  4. calling webservices?

calling webservices?

Scheduled Pinned Locked Moved Windows API
csharpxmlwcfhelpquestion
1 Posts 1 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 a IE toolbar in which I call the webservices written in C#. There is one webservice for uploading a file. Everything works fine in XP but in Vista after uploading 1 file successfully I am not able to upload any other files and the responseText for all the remaining file is empty?Can anybody help me out.

    MSXML::IXMLHttpRequestPtr httpReq( _uuidof(XMLHTTPRequest));

    	\_bstr\_t  HTTPMethod;
    	\_variant\_t noAsync = \_variant\_t((bool)false);
    
    	HTTPMethod = \_bstr\_t("POST");
    	httpReq->open(HTTPMethod ,"https://localhost/common/qptwebservicedownload.asmx",noAsync,vtMissing,vtMissing);
    	httpReq->setRequestHeader("Content-Type","application/soap+xml");
    		
    	data = NULL;
    	strBase64.Empty(); 
    
    	CString defaultJpgAlertCasheFilename=ob.FilePath;
    	unsigned \_\_int64 AttachmentSize=SubGetFileSize(defaultJpgAlertCasheFilename);			
    	
    	CFile sourceFile;
    	sourceFile.Open(defaultJpgAlertCasheFilename,CFile::modeRead);
    	
    	data = new BYTE \[AttachmentSize\];
    	sourceFile.Read(data, AttachmentSize);
    	sourceFile.Close();
    			
    	CBase64 ob1;
    	ob1.Encode(data,AttachmentSize);
    	ob1.m\_pEBuffer; 
    		
    	strBase64=CString(ob1.m\_pEBuffer);
    	Part1="<?xml version=\\"1.0\\" encoding=\\"utf-8\\"?> \\
    	<soap12:Envelope xmlns:xsi=\\"http://www.w3.org/2001/XMLSchema-instance\\" xmlns:xsd=\\"http://www.w3.org/2001/XMLSchema\\" xmlns:soap12=\\"http://www.w3.org/2003/05/soap-envelope\\"> \\
    	<soap12:Body>\\
    	<UploadFile xmlns=\\"http://rigelnetworks.net/\\">";
    
    	Part2="<ByteArr>";
    	Part2+=strBase64;
    	Part2+="</ByteArr>";
    
    	Part2+="<FormletDocletID>";
    	Part2+=ob.FormletId;
    	Part2+="</FormletDocletID>";
    
    	Part2+="<IsFormlet>";
    	Part2+=ob.BitField;
    	Part2+="</IsFormlet>";
    	
    	Part3="</UploadFile>\\
    	</soap12:Body>\\
    	</soap12:Envelope>";
    
    	szRequest=Part1;
    	szRequest+=Part2;
    	szRequest+=Part3;
    	
    	vRequest.vt = VT\_BSTR;
    	vRequest.bstrVal = szRequest.AllocSysString();
    
    	HRESULT hr=httpReq->send(vRequest);
    
    	\_bstr\_t bsResponse = httpReq->responseText;
    
    	CString response;
    	response=bsResponse.copy();
    
    	nPos1=response.Find("<UploadFileResult>");
    	nPos2=response.Find("</UploadFileResult>"); 
    	nPos1+=18;
    	szResult=response.Mid(nPos1,(nPos2-nPos1)); 
    	
    	if(szResult.GetLength()>0)
    	{
    		szResult.MakeLower();
    		if(szResult=="true")
    			bFlg=true;
    	}
    

    In Vista the _bstr_t bsResponse = httpReq->responseText; contains vali

    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