•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 425,996 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 1,681 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser: Programming Forums
Views: 4789 | Replies: 0
![]() |
•
•
Join Date: Aug 2006
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
Iam trying to call a C# DotNet 2003 webservice from Visual C++ 6 app (used win32 console, mfc, atl_mfc dll) using Soap toolkit 3. The webservice takes a String input parameter and returns a String. The input parameter I pass through C++ is always recieved as NULL in C# webservice while the output is working fine and it is returned back in C++.
I have even tried with wsp wizard using atl_mfc dll and vb GUI but input always failed. It didn't give any error either. It will give an error when I output, input parameter as it is without appending to a string, then it will say Invalid pointer error in C++ app. Plz anybody can help in this regard. A bundle of thanks.
My C# webservice code is as, it is a simple ASP.NET web service generated through VS.NET 2003:
I have even tried with wsp wizard using atl_mfc dll and vb GUI but input always failed. It didn't give any error either. It will give an error when I output, input parameter as it is without appending to a string, then it will say Invalid pointer error in C++ app. Plz anybody can help in this regard. A bundle of thanks.
My C# webservice code is as, it is a simple ASP.NET web service generated through VS.NET 2003:
[WebMethod]
public string TestMethod(string input)
{
return "Hello World"+input;
}
My C++ code is as:
#include <stdio.h>
#import "msxml4.dll"
using namespace MSXML2;
#import "C:\Program Files\Common Files\MSSoap\Binaries\MSSOAP30.dll" \
exclude("IStream", "ISequentialStream", "_LARGE_INTEGER", "_ULARGE_INTEGER", "tagSTATSTG", "_FILETIME")
using namespace MSSOAPLib30;
ISoapSerializerPtr Serializer;
ISoapReaderPtr Reader;
ISoapConnectorPtr Connector;
// Connect to the service
Connector.CreateInstance(__uuidof(HttpConnector30));
Connector->Property["EndPointURL"] = "http://localhost/WS/Service1.asmx";
Connector->Connect();
// Begin message
Connector->Property["SoapAction"] = "http://tempuri.org/TestMethod";
Connector->BeginMessage();
// Create the SoapSerializer
Serializer.CreateInstance(__uuidof(SoapSerializer30));
// Connect the serializer to the input stream of the connector
Serializer->Init(_variant_t((IUnknown*)Connector->InputStream));
// Build the SOAP Message
Serializer->StartEnvelope("","","");
Serializer->StartBody("");
Serializer->StartElement("TestMethod","http://tempuri.org/TestMethod","","m");
Serializer->StartElement("input","","","");
Serializer->WriteString("input");
Serializer->EndElement();
Serializer->EndElement();
Serializer->EndBody();
Serializer->EndEnvelope();
// Send the message to the web service
Connector->EndMessage();
// Let us read the response
Reader.CreateInstance(__uuidof(SoapReader30));
// Connect the reader to the output stream of the connector
Reader->Load(_variant_t((IUnknown*)Connector->OutputStream), "");
// Display the result
printf("Answer: %s\n", (const char *)Reader->RpcResult->text);
_bstr_t res = Reader->RpcResult->text; Last edited by cscgal : Aug 23rd, 2006 at 1:26 am. Reason: Added code tags
![]() |
•
•
•
•
•
•
•
•
DaniWeb C++ Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- Calling external files (C++)
- Having trouble calling certain functions (C++)
- performance benefit by not calling static member function by object (C)
- calling a SQL UDF? (PHP)
- how to simultaneously run 2 programs by calling one from another (C)
- Still need info on calling a function from bool! (C++)
- calling methods. (Java)
- Calling Oracle Stored Procedures with ASP (ASP)
Other Threads in the C++ Forum
- Previous Thread: VC++ problem agian
- Next Thread: Help with a problem with C++ program


Linear Mode