Click here to Skip to main content
15,921,660 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Registry problems, help! Pin
Tom Wright31-May-03 18:07
Tom Wright31-May-03 18:07 
GeneralThanks! Pin
Steven M Hunt31-May-03 18:21
Steven M Hunt31-May-03 18:21 
GeneralDialog based app problem Pin
Tom Wright31-May-03 16:40
Tom Wright31-May-03 16:40 
GeneralRe: Dialog based app problem Pin
Paul Lyons31-May-03 17:45
Paul Lyons31-May-03 17:45 
GeneralRe: Dialog based app problem Pin
Tom Wright31-May-03 17:53
Tom Wright31-May-03 17:53 
GeneralRe: Dialog based app problem Pin
Michael Dunn31-May-03 18:43
sitebuilderMichael Dunn31-May-03 18:43 
GeneralRe: Dialog based app problem Pin
Tom Wright2-Jun-03 7:57
Tom Wright2-Jun-03 7:57 
GeneralXML Post from VC++ Pin
Member 41868531-May-03 12:28
Member 41868531-May-03 12:28 
I have a need to call a Java servlet running in Solaris from Java and VC++ application. Basically i will be doing a http post to a url and sending a UTF-8 encoded GZip compressed XML document. I will get return as XML document from the servlet. I am able to achieve the required funtionality in Java applicaion as follows.

PrintWriter out = null;
connection = (HttpURLConnection) servlet.openConnection();
connection.setDoOutput(true);
connection.setUseCaches(false);
connection.setDoInput(true);
connection.setRequestMethod("POST");
out =
new java.io.PrintWriter(
new OutputStreamWriter(
new GZIPOutputStream(connection.getOutputStream()),
"UTF8"),
true);

out.println(argString);

out.flush();
out.close();

GZIPInputStream in = new GZIPInputStream(connection.getInputStream());
BufferedReader buff = new BufferedReader(new InputStreamReader(in));
output = buff.readLine();


The same functionality i need to implement it in a VC++ application. During my post in the Java servlet it is giving stream not serialized and also i don't know how to do gzip compression for the post operation. I am using the following code,

IXMLHTTPRequestPtr pIXMLHTTPRequest = NULL;
HRESULT hr;

try {
CoInitialize(NULL);
hr=pIXMLHTTPRequest.CreateInstance("Msxml2.XMLHTTP");
SUCCEEDED(hr) ? 0 : throw hr;

hr=pIXMLHTTPRequest->open("POST", "http://url.Servlet", false);
SUCCEEDED(hr) ? 0 : throw hr;

hr=pIXMLHTTPRequest->setRequestHeader("Content-Type", "text/xml");
SUCCEEDED(hr) ? 0 : throw hr;


hr=pIXMLHTTPRequest->send(bstrString);
SUCCEEDED(hr) ? 0 : throw hr;

bstrString=pIXMLHTTPRequest->responseText;

MessageBox(_bstr_t(bstrString), _T("Results"), MB_OK);

if(bstrString)
{
::SysFreeString(bstrString);
bstrString = NULL;
}

} catch (...) {
MessageBox(_T("Exception occurred"), _T("Error"), MB_OK);
if(bstrString)
::SysFreeString(bstrString);
}

If some one can provide some sample to achive this functionality in VC++ will be helpful.
GeneralRe: XML Post from VC++ Pin
Ravi Bhavnani31-May-03 13:34
professionalRavi Bhavnani31-May-03 13:34 
GeneralPlease Help Me Pin
Nazar Hussain31-May-03 12:12
sussNazar Hussain31-May-03 12:12 
GeneralRe: Please Help Me Pin
Anna-Jayne Metcalfe2-Jun-03 0:10
Anna-Jayne Metcalfe2-Jun-03 0:10 
GeneralRe: Please Help Me Pin
Anonymous2-Jun-03 12:03
Anonymous2-Jun-03 12:03 
GeneralCombo boxes Pin
Zak_31-May-03 7:09
Zak_31-May-03 7:09 
GeneralRe: Combo boxes Pin
Jan van den Baard31-May-03 7:33
professionalJan van den Baard31-May-03 7:33 
GeneralRe: Combo boxes Pin
Zak_1-Jun-03 5:53
Zak_1-Jun-03 5:53 
GeneralRe: Combo boxes Pin
Jan van den Baard1-Jun-03 19:43
professionalJan van den Baard1-Jun-03 19:43 
GeneralProblems with MFC (Without wizard) Pin
Bob Stanneveld31-May-03 6:39
Bob Stanneveld31-May-03 6:39 
GeneralRe: Problems with MFC (Without wizard) Pin
Vikram A Punathambekar31-May-03 8:51
Vikram A Punathambekar31-May-03 8:51 
GeneralRe: Problems with MFC (Without wizard) Pin
Bob Stanneveld31-May-03 9:00
Bob Stanneveld31-May-03 9:00 
GeneralRe: Problems with MFC (Without wizard) Pin
Vikram A Punathambekar31-May-03 9:13
Vikram A Punathambekar31-May-03 9:13 
GeneralList Box Style Pin
georgiek5031-May-03 6:00
georgiek5031-May-03 6:00 
GeneralRe: List Box Style Pin
Ravi Bhavnani31-May-03 8:47
professionalRavi Bhavnani31-May-03 8:47 
GeneralCButton question Pin
rpadrela31-May-03 5:26
rpadrela31-May-03 5:26 
GeneralRe: CButton question Pin
valikac31-May-03 7:01
valikac31-May-03 7:01 
GeneralRe: CButton question Pin
Joan M1-Jun-03 21:01
professionalJoan M1-Jun-03 21:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.