how to use XMLHTTP on vbscript?


I need to query a service. I am using vbscript. The below script opens a connection with a post request. The request sends name and pass to the service for authentication. If authentication works, and xml response string is returned at the end.

I am getting a browser error. It reads
Line: 12
Char: 21
Error: Expected end of statement
URL: http://..........

Please, can someone help me create my string. I think that vbscript does not like some of the characters in requestBody variable.


Dim xmlRequest As New MSXML2.XMLHTTP "POST", "", False
        xmlRequest.setRequestHeader "Content-Type", "text/xml; charset=utf-8"

        Dim requestBody As String

        requestBody = "<?xml version='1.0' encoding='utf-8'?>" & vbCrLf
        requestBody = requestBody & "<soap12:Envelope xmlns:xsi='' xmlns:xsd='' xmlns:soap12=''>" & vbCrLf
        requestBody = requestBody & "<soap12:Body>" & vbCrLf
        requestBody = requestBody & "<Process xmlns='Smart'>" & vbCrLf
        requestBody = requestBody & "<name>" & "val1" & "</UserName>" & vbCrLf
        requestBody = requestBody & "<pass>" & "val2" & "</Password>" & vbCrLf        
        requestBody = requestBody & "</Process>" & vbCrLf
        requestBody = requestBody & "</soap12:Body>" & vbCrLf
        requestBody = requestBody & "</soap12:Envelope>" & vbCrLf
        xmlRequest.send (requestBody)

        resp = xmlRequest.responseText

        document.write resp

Open in new window

Who is Participating?
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.

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
Dhanasekaran SengodanCommented:
Use this link

Hopes its very Useful
vielkacarolina1239Author Commented:
Got it, 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 Components

From novice to tech pro — start learning today.