.NET C# webservices and VC++ SOAP client
i have developed webservices using... .NET C# .
i can use C# client for webservices without any problem ..but while using VC++ client. im not able to get results of operation why????
here is Servieces and client
using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
[WebService(Namespace = "http:/www.WbService07Name.com/webServices/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class ClsService07 : System.Web.Services.WebService
{
public ClsService07()
{
//Uncomment the following line if using designed components
//InitializeComponent();
}
[WebMethod]
public string HelloWorld() {
return "Hello World in console ";
}
[WebMethod]
public double DoAdditon(double a, double b)
{
return (a + b);
}
[WebMethod]
public string DispalyMethod(string str)
{
return (str + "Inside DispalyMethod");
}
}
////////////////////////////////client vc++////////////////////////
void DisplayAdd()
{
try
{
ISoapSerializerPtr Serializer;
ISoapReaderPtr Reader;
ISoapConnectorPtr Connector;
cout<<"test display:main\n";
// Connect to the service
Connector.CreateInstance(__uuidof(HttpConnec tor30));
Connector->Property["EndPointURL"] ="http://localhost:1395/WbSer07/Service.asmx?wsdl";
Connector->Connect();
Connector-> Property["SoapAction"] = ""http:/www.WbService07Name.com/DoAdditon";
// Begin message
Connector->BeginMessage();
// Create the SoapSerializer
Serializer.CreateInstance(__uuidof(SoapSeria lizer30));
// 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("DoAdditon08",L"http://localhost:1395/WbSer08/Service.asmx/","","");
Serializer->StartElement("a","","","");
Serializer->WriteString("10.1");
Serializer->EndElement();
Serializer->StartElement("b","","","");
Serializer->WriteString("23.1");
Serializer->EndElement();
Serializer->EndElement();
Serializer->EndBody();
Serializer->EndEnvelope();
// Send the message to the web service
Connector->EndMessage();
// Let us read the response
HRESULT hr = Reader.CreateInstance(__uuidof(SoapReader30));
// Connect the reader to the output stream of the connector
Reader->Load(_variant_t((IUnknown*)Connector->OutputStream), "");
printf("Answer: %s\n",(const char*)Reader->RpcResult->text);
BSTR br;
Reader->RpcResult->get_text(&br);
MSXML2::IXMLDOMElementPtr aTEST = Reader->RpcResult;
BSTR aTest1;
aTEST->get_xml(&aTest1);
printf("Answer: %s\n",reinterpret_cast<const char*>(br));
cout<<endl;
cout<<BSTRtoChar(br)<<endl;
Connector=NULL;
Serializer=NULL;
Reader=NULL;
}
catch(...)
{
cout<<"Error in execution :main\n";
}
}
int _tmain(int argc, _TCHAR* argv[])
{
CoInitialize(NULL);
DisplayAdd();
CoUninitialize();
return 0;
}
i m getting result ...0 always while calling "DoAdditon" method..
help me..?
|