Click here to Skip to main content
6,634,665 members and growing! (16,019 online)
Email Password   helpLost your password?
Web Development » Web Services » General     Intermediate

Calling WebServices Using SPROXY in VC++

By Ganesh_T

Calling WebServices methods using sproxy.exe provided by Visual Studio 2003
C#, VC7, Windows, .NET, Visual Studio, MFC, ATL, Dev
Posted:14 Jun 2006
Views:19,277
Bookmarked:11 times
Unedited contribution
Announcements
Loading...
 
Search    
Advanced Search
Add to IE Search
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
11 votes for this article.
Popularity: 1.69 Rating: 1.63 out of 5
9 votes, 81.8%
1

2

3

4
2 votes, 18.2%
5

Introduction

Some days ago I faced the problem of calling the Webservices from VC++ 6.0 written in C#. The I searched on Google and found the article by Neil Yao that was very useful. Then I started to find the another way for calling the webservices. I came to know about the SPROXY.EXE. It is a command line tool that generates native C++ client code for accessing an XML Web service based on a WSDL description.

Soap Features:

Soap is a protocol which helps to communicate between the applications. Sending messages through internet. It is language independent, platform independent and is based on XML. Today the better way to communicate between is via Http request. Soap was brought in for this purpose.

Creating the Application:


First Step: Creating Web Service : Create the virtual directory and in that Create the Asp.net web Service project. Name it as MyWebService . In Implementation file that is MyWebService.asmx.cs file write the below code after the Component Designer Generated Code heading: [WebMethod] // Web method which will be exposed by the webservice. public string MyFun(String strMyName) { return "Hello " + strMyName; } Now build the WebService.

Second Step: Using SPROXY.EXE Go to the Visual studio 2003 command prompt there you type the following line: sproxy/wsdl Webservice_URL It will generate one header file which is native code. In this file the namespace name and Class name is same and you can find their signatures there.

Third Step: Creating MFC Application I am using Visual Studio 2003. Create New VC++ project then choose MFC Application after that you will see the MFC Application wizard. Click on Application type and Select dialog based application and Click finish. Now go to Resource view, place one button on it and name it as Call WebService and name of button as btnWebService. Double Click on the button you will see the message handler added for the button. You will See the OnbtnWebService() function being added. Now add the file created in Step Second in the Application. You will find the new class been created there. Now on click of OnbtnWebService() create the object of class and you can invoke the WebServices Methods. For this you have to include the header file and write the one more statement as:

Using namespace createdby_Sproxy;

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Ganesh_T


Member

Occupation: Web Developer
Location: India India

Other popular Web Services articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 5 of 5 (Total in Forum: 5) (Refresh)FirstPrevNext
GeneralMy vote of 1 Pinmembersyberchic10:07 20 Apr '09  
QuestionHow can we add the header authentication information? Pinmemberpushkarnap3:41 6 Jun '07  
GeneralRe: How can we add the header authentication information? PinmemberSudhir Mangla2:16 18 Mar '08  
Questionsoap-fault: No deserializer found ... PinmemberKarsten1:50 26 Mar '07  
GeneralImprovement PinmemberKarstenK5:14 14 Jun '06  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 14 Jun 2006
Editor:
Copyright 2006 by Ganesh_T
Everything else Copyright © CodeProject, 1999-2009
Web21 | Advertise on the Code Project