Authentication to Exchange Web Services 2007 using raw SOAP/XML

I'm trying to use VB6 to do POST requests to Exchange Web Services 2007.  I don't have the fancy tools from .NET so I would like to do this as a simple HTTPS POST and manually create the SOAP/XML to keep this as simple as possible.  I think I understand how to build the EWS request but I'm not sure how to authenticate with the Exchange username/password using raw XML and a simple HTTPS POST?  If I navigate directly to the POST URL below in IE, it prompts me with a popup for my user/pwd and after I enter that I get back the WSDL Definitions, so I'm pretty sure the URL and credentials are correct.  I just can't figure out how to post those credentials via normal HTTPS POST?  When I try I get 401:Unauthorized.

Thanks and here is what I'm posting and to where:



<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap=""
    <GetFolder xmlns=""
        <t:DistinguishedFolderId Id="inbox"/>
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Deepu SreedharBI Software EngineerCommented:
Did you try with Microsoft WSE?
Mutare99Author Commented:
Can Microsoft WSE be used with VB6?  It seems it is only for VS .NET.  If there is something similar for VB6 that might work, but if I can get this to authenticate I don't need any fancy managed API.  I can handle sending the SOAP requests but I just can't figure out how to get it to authenticate.  In .NET you use something like this below with the NetworkCredentials() method.  I need to figure out how to do that in VB6:

        Dim esb As New ExchangeServiceBinding
        esb.RequestServerVersionValue = New RequestServerVersion
        esb.RequestServerVersionValue.Version = ExchangeVersionType.Exchange2007_SP1
        esb.Credentials = New NetworkCredential("username", "password", "domain")
Deepu SreedharBI Software EngineerCommented:
Oh ok... So what about WinHttp? Like...

Dim objWHttp
Set objWHttp= CreateObject("WinHttp.WinHttpRequest.5.1")
objWHttp.Open "POST", strUrl
Call objWHttp.SetCredentials(strUserName,strPassword,0)
objWHttp.SetRequestHeader "xxx","yyy"
objWHttp.SetRequestHeader "xxx","yyy"
objWHttp.SetRequestHeader "xxx","yyy"
Call objWHttp.Send(YourDataHere)
Set objWHttp=Nothing

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

Mutare99Author Commented:
That may be just what I need.  I'll try it out and let you know.  Thanks!
Mutare99Author Commented:
I think that's close but I still get 401:unauthorized and I know those credentials work from a .NET test app.  Does the .NET NetworkCredentials() method do anything to them like encode/encrypt?  I'm thinking I may need to do something to the username/pwd before passing them?  I thought I saw that Exchange Web Services expects NTLM authentication, but not sure how to handle that.
Mutare99Author Commented:
I ended up using a 3rd party tool instead of the WinHTTP object, but this is essentially how it worked with it as well.  Thanks.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.