473,624 Members | 2,235 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Returning a string from DOM?

5 New Member
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 "understand s" 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::GetRo omAndNameOut(LP CTSTR 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(szSOAPR eq, g_lpszSOAPReqMu ltiple3, Name);
sprintf(szSOAPR eq2, g_lpszSOAPReqMu ltiple4, i);
strcat(szSOAPRe q3, szSOAPReq);
strcat(szSOAPRe q3, szSOAPReq2);
//MessageBox(szSO APReq3);

// Create an instance of HBP
CComPtr<IXMLHTT PRequest> spSoapFunc;
HRESULT hr = spSoapFunc.CoCr eateInstance(CL SID_XMLHTTP60);
CHECK_HR(hr);

// Initialize the Synchronous HTTP POST request
hr = spSoapFunc->open(_bstr_t(_ T("POST")), g_lpszSOAPEndpo intURL, VARIANT_FALSE);
CHECK_HR(hr);


// Set the required Content-Type header
hr = spSoapFunc->setRequestHead er(_bstr_t(_T(" Content-Type")), _bstr_t(_T("tex t/xml")));
CHECK_HR(hr);


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


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

spResultNode = spResponseXMLDo c->selectSingleNo de(_bstr_t(_T("//ResultNameAndRo om")));

if(spResultNode .p != NULL)
{
Room = spResultNode->nodeTypedValue ;
MessageBox("Suc cess");
}
else
MessageBox("The res a problem commander");
}
else
{
MessageBox("\nE rror: %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 1956
omgoosh
5 New Member
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
2922
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 construction and then.. // some other processing and/or changing 'retval' return retval; }
13
4502
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. So does Gnome::Vfs::FileInfo::get_name(). Isn't that unnecessary overhead? I could as well return by reference to const-string and avoid
5
2267
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 foo(const std::string& rhs) { std::string var = rhs ; var += " received" ;
7
2307
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
2078
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) { CDFDBSoapService.DBWebService dbws = new CDFDBSoapService.DBWebService(); Do the connection stuff here... return dbws.queryDatabase(sql); }
5
19579
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 having a problem in the calling program. I searched online and found suggestions that I return an Array instead so I modified my code (below) to return an Array instead of an ArrayList. Now I get the message when I try to run just my webservice...
2
1626
by: Asim Qazi | last post by:
Hi All public class MyResponse { public bool m_bStatus; public string m_szErrorCode; public string m_szMessage; }
13
2545
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 data from a query into an array. The intent is that the following code:
7
2867
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 returned string object still valid after myfunction() has returned? I
8
2209
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
8238
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8624
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8336
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7164
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6111
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5565
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4176
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2607
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1485
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.