Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

SOAP Toolkit vc++ 6.0

Posted on 2006-04-03
3
Medium Priority
?
910 Views
Last Modified: 2008-01-09
I am having some problems connecting to web services with soap through c++ I have looked at numerous examples and followed the help documentation from microsofts SOAP Toolkit.  I have also tried using the webreferences feature of .net.

My problem is that I have to develop in c++ and add SOAP services to an application.  I have been using the following example code from code guru.

#include <stdio.h>

#import "msxml4.dll"
using namespace MSXML2;
#import "C:\Program Files\Common Files\MSSoap\Binaries\mssoap30.dll" \
exclude("IStream", "IErrorInfo", "ISequentialStream", "_LARGE_INTEGER", \
"_ULARGE_INTEGER", "tagSTATSTG", "_FILETIME")
using namespace MSSOAPLib30;

void main()
{
CoInitialize(NULL);

ISoapSerializerPtr Serializer;
ISoapReaderPtr Reader;
ISoapConnectorPtr Connector;

// Connect to the service
Connector.CreateInstance(__uuidof(HttpConnector30));
Connector->Property["EndPointURL"] =
"http://www.allesta.net:51110/webservices/soapx4/isuseronline.php";;
Connector->Connect();

// Begin message
Connector->Property["SoapAction"] = "uri:allesta-YahooUserPing";
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("isuseronline",
"uri:allesta-YahooUserPing",
"",
"m");
Serializer->StartElement("username","","","");
Serializer->WriteString("laghari78");
Serializer->EndElement();
Serializer->EndElement();
Serializer->EndBody();
Serializer->EndEnvelope();

// Send the message to the web service
Connector->EndMessage();

// 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);
CoUninitialize();

}

All I get is an abnormal program termination message.

I have SOAPToolkit 3.0 installed and I have MSXML4 installed.  If anyone could point me in the right direction or give me an idea why this might be crashing it would be very appreciated.  It seems to be crashing at the EndMessage line.  I have tried numerous url's which cause earlier crashes at the Property["EndPointUrl"] line.

Thanks
Kurt
0
Comment
Question by:rowlandk
  • 2
3 Comments
 
LVL 3

Accepted Solution

by:
Raj_Kau earned 1000 total points
ID: 16367630
Hi rowlandk
this code do not have any error checking so please do first error checking. Because you did not check you code connect or not you just execute the connect command and suppose if your programme not connect so when you go to send or go to EndMessage then its give error.
So please make error checking and then run


Raj
0
 
LVL 3

Expert Comment

by:Raj_Kau
ID: 16397857
Hi rowlandk
i think your problem solved.

Raj

0
 

Author Comment

by:rowlandk
ID: 16399713
I was unable to solve that specific problem, if you have an idea I would love to hear it.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Make the most of your online learning experience.
When you discover the power of the R programming language, you are going to wonder how you ever lived without it! Learn why the language merits a place in your programming arsenal.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Progress

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question