Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > .NET Web Services
|
.NET Web Services Discussions about .NET XML Web Service technologies including ASMX files, WSDL and SOAP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Web Services section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 10th, 2007, 10:09 PM
Registered User
 
Join Date: Jun 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default .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..?





Similar Threads
Thread Thread Starter Forum Replies Last Post
C# client for SOAP::Lite web service wirespring C# 0 December 8th, 2006 07:14 PM
activating a SOAP extension from a client Robert Rotstein ASP.NET 1.0 and 1.1 Professional 0 January 10th, 2006 11:18 AM
Connection to Oracle with ADO.NET In Webservices shahnawaz ADO.NET 1 October 10th, 2005 04:31 AM
Soap Client & Permissions jlick Pro VB 6 0 June 22nd, 2004 10:38 AM
.NET WebServices vs Rest firdausnasar .NET Web Services 0 June 3rd, 2003 10:31 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.