VC++ && Webservices

Posted on 2005-05-16
Last Modified: 2013-11-20

hi All experts, I have a question for you
Can i use Webservices in VC6++ application?
If so, how do i do that?

A good answer is a project example and some guide line about it, i think.
All replies are appriciate
Question by:nghiaap
    LVL 30

    Assisted Solution

    You can use the MFC classes CInternetSession, CHttpConnection, CHttpFile

    Code will be something like this

              CInternetSession oSession;
              TCHAR szTemp [10000];
              memset(szTemp, 0 , 10000);
              //connect to the WebService with the given address

              int nSlashIndex = m_csIPAddress.Find('/',0);
              if( nSlashIndex == -1)
                   m_csWebServer  = m_csIPAddress;
                   m_csWebServer  = m_csIPAddress.Left( nSlashIndex );

              CHttpConnection* pCon = oSession.GetHttpConnection( m_csWebServer );

              CHttpFile* pFile = 0;

              nSlashIndex = m_csIPAddress.Find('/',0);

              if(nSlashIndex != -1)
                   m_csIPAddress = m_csIPAddress.Right(m_csIPAddress.GetLength()-nSlashIndex);

              CString csRequest = m_csIPAddress + "/WebServiceFolder/WebServiceCalling File.ext?";  <--- PLACE YOUR WEBSERVICE NAME HERE
              pFile = pCon->OpenRequest(CHttpConnection::HTTP_VERB_POST,csRequest );

              if( pFile == NULL )
                   throw "OpenRequest() failed";

              if( pFile->SendRequestEx(nRequestLength) )


              if(pFile->Read(szTemp, 10000) < 1 )
                   throw "Read(szTemp, 10000) failed";

    LVL 86

    Accepted Solution

    MS and therefore MFC maily use SOAP for web services. Check out ("SOAP: Using ATL Server to Build an Asynchronous SOAP Client in Unmanaged C++ -- MSDN Magazine, April 2002"). Also, there a some samples available at ("Samples that demonstrate XML Web services and clients accessible with SOAP and created using the support provided by ATL Server")
    LVL 86

    Expert Comment

    BTW, ("WebResourceProvider - A framework to allow public web services to be used as objects in your application") could be interesting also.
    LVL 3

    Assisted Solution

    Using the CinternetFile , you can download the dynamic XML pages from internet and create the simple consumner application.
    LVL 1

    Author Comment

    Is it that there are so many for me ;) (just joking), ok i'll give them a try, thks aaaallllll

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
    Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
    This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now