how to use XMLHTTP on vbscript?

Hello,

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
Code:0
URL: http://..........

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

Thanks,

Dim xmlRequest As New MSXML2.XMLHTTP
        xmlRequest.open "POST", "https://myDomain.com/Dir/pg123.asmx", 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='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap12='http://www.w3.org/2003/05/soap-envelope'>" & 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

vielkacarolina1239Asked:
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

http://support.microsoft.com/kb/290591

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

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.