470,815 Members | 1,246 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,815 developers. It's quick & easy.

How to connect to web service from C++

Hi,

I have created a simple Web service with only one function, which
takes only one parameter.
Below is the function from Web service
[WebMethod]
public string HelloWorld(string input)
{
return "Hello World"+input+"Here";
}
I am trying to access to this function from C++.Below is the Code

ISoapSerializerPtr Serializer;
ISoapReaderPtr Reader;
ISoapConnectorPtr Connector;
// Connect to the service
Connector.CreateInstance(__uuidof(HttpConnector));

Connector->Property["EndPointURL"] = "http://localhost/
FinalService/
Service1.asmx";
Connector->Connect();
// Begin message
Connector->Property["SoapAction"] = "http://tempuri.org/
HelloWorld";
Connector->BeginMessage();
// Create the SoapSerializer
Serializer.CreateInstance(__uuidof(SoapSerializer) );
// 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("HelloWorld","http://tempuri.org/
HelloWorld","","m");
Serializer->startElement("input","","","");
Serializer->writeString( "Test");
Serializer->endElement();
Serializer->endElement();
Serializer->endBody();
Serializer->endEnvelope();

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

But here the C++ code is passing the empty value to the Web service
because when I display
the o/p is "Hello WorldHere".
I am expecting "Hello WorldTestHere". but it is not displaying.

Please can any one tell me how to pass the parameter value?

Thanks,
Manjunath.M
Jun 27 '08 #1
0 2528

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

20 posts views Thread by Mr Dygi | last post: by
reply views Thread by Jim | last post: by
1 post views Thread by Mike Stephens | last post: by
10 posts views Thread by blurryimage | last post: by
1 post views Thread by Manjunath.M | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.