473,320 Members | 2,054 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Returning a string from DOM?

Hello! I'm new here so feel free to criticize me if my question is worded poorly, or if I'm asking too much, or if you just don't like me thats fine too!

Desirable Result: I'm trying to make a C++ application which sends a SOAP message to a php server, which in turn sends back a SOAP message that the C++ application will look at and be able to understand it.

Current Result: I have a C++ application which sends a SOAP message to the php server, and the php server sends back a soap message containing a number which the C++ application "understands" and changes its reply based on what number is returned.

Problem: I can't figure out how to send the SOAP response message (as a string, character array, array of strings) back to the C app. I'm using DOM and the function which gets the response from the php server from the C++ side is like thus:

float CHBP1Dlg::GetRoomAndNameOut(LPCTSTR Name, LPCTSTR RoomNumber)
{
float Room;
int i = atoi(RoomNumber);

USES_CONVERSION;

// SOAP Request Envelop to be posted
TCHAR szSOAPReq[MAX_PATH*2] = {0};
TCHAR szSOAPReq2[MAX_PATH*2] = {0};
TCHAR szSOAPReq3[MAX_PATH*2] = {0};
sprintf(szSOAPReq, g_lpszSOAPReqMultiple3, Name);
sprintf(szSOAPReq2, g_lpszSOAPReqMultiple4, i);
strcat(szSOAPReq3, szSOAPReq);
strcat(szSOAPReq3, szSOAPReq2);
//MessageBox(szSOAPReq3);

// Create an instance of HBP
CComPtr<IXMLHTTPRequest> spSoapFunc;
HRESULT hr = spSoapFunc.CoCreateInstance(CLSID_XMLHTTP60);
CHECK_HR(hr);

// Initialize the Synchronous HTTP POST request
hr = spSoapFunc->open(_bstr_t(_T("POST")), g_lpszSOAPEndpointURL, VARIANT_FALSE);
CHECK_HR(hr);


// Set the required Content-Type header
hr = spSoapFunc->setRequestHeader(_bstr_t(_T("Content-Type")), _bstr_t(_T("text/xml")));
CHECK_HR(hr);


// Send the POST request, along with the SOAP request envelope text
hr = spSoapFunc->send(_bstr_t(szSOAPReq3));
CHECK_HR(hr);


if(200 == spSoapFunc->status) //Success
{
// using MSXML DOM to process SOAP response XML text
CComQIPtr <IXMLDOMDocument2> spResponseXMLDoc;
CComPtr <IXMLDOMNode> spResultNode;
spResponseXMLDoc = spSoapFunc->responseXML;

spResultNode = spResponseXMLDoc->selectSingleNode(_bstr_t(_T("//ResultNameAndRoom")));

if(spResultNode.p != NULL)
{
Room = spResultNode->nodeTypedValue;
MessageBox("Success");
}
else
MessageBox("Theres a problem commander");
}
else
{
MessageBox("\nError: %s\n"), W2A(spSoapFunc->statusText);
}
return Room;
}

Already tried:
-Changing float to char (haha) for all parameters: caused error with nodeTypedValue
-Changing NodeTypedValue to anything else: no good

So I know I have to do something where the DOM programming is concerned... does anyone know what that something is? How I can make it so that this function can return a string value from the result node? Any help, any comments, even if just to say "You're a moron", ANYTHING would be accepted warmly. I have posted this question on 3 forums including microsofts website with not even one response.
Jun 18 '07 #1
1 1941
Repeating statement: If anyone is out there, I don't mind if you don't have insight onto my problem, but I would appreciate ANY criticism, any insight, any comments. I am a little disappointed that forums online thus far have garnered a total of one response : /. If no one knows how to answer my question, could they at least offer me another forum to try? I don't mean to sound bitter, but I've been at this problem for a few days now and its my first time going so long for a single problem. Thanks in advance!
Jun 19 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

25
by: Victor Bazarov | last post by:
In the project I'm maintaining I've seen two distinct techniques used for returning an object from a function. One is AType function(AType const& arg) { AType retval(arg); // or default...
13
by: Matthias Kaeppler | last post by:
Hi, I was wondering why library implementors often make getter functions return strings by value (copies). For example, in boost::filesystem the leaf() function returns an std::string by value....
5
by: Alfonso Morra | last post by:
Hi, What is the recomended way of returning an STL container (e.g. std::string, std::vector etc fom a function? Is it by simply returning a local variable? (I doubt it) std::string...
7
by: wonderboy | last post by:
Hey guys, I have a simple question. Suppose we have the following functions:- //-----My code starts here char* f1(char* s) { char* temp="Hi"; return temp;
1
by: Randy | last post by:
Hello, I have a web service in which I'm doing a query to an Access database and returning the resulting XML data when I do the return from the service... public string AOS_Data(string sql) {...
5
by: Stacey Levine | last post by:
I have a webservice that I wanted to return an ArrayList..Well the service compiles and runs when I have the output defined as ArrayList, but the WSDL defines the output as an Object so I was...
2
by: Asim Qazi | last post by:
Hi All public class MyResponse { public bool m_bStatus; public string m_szErrorCode; public string m_szMessage; }
13
by: Karl Groves | last post by:
I'm missing something very obvious, but it is getting late and I've stared at it too long. TIA for responses I am writing a basic function (listed at the bottom of this post) that returns...
7
by: Thomas Lenz | last post by:
Please consider the following code snippet: string myfunction() { ostringstream oss; oss << "junk"; // do something more with oss; I can't make it const... return oss.str(); } Is the...
8
by: darren | last post by:
Hi everybody, have a quick look at this code: ===== ===== int main(void) { string msg; makeString(msg); cout << "back in main, result = " << msg << endl;
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.