Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > .NET Web Services
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
.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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 10th, 2007, 10:09 PM
Registered User
 
Join Date: Jun 2007
Location: , , .
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..?
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 08:19 PM.


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