WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: atlanta1213 on March 06, 2014, 09:18:39 AM

Title: HTTP verbs - OPTIONS
Post by: atlanta1213 on March 06, 2014, 09:18:39 AM
I am trying to connect to a web site and make an OPTIONS request.  I am not sure if I can or how to set the HTTP verb I want to use, in this case OPTIONS

My example is:

https://websitename/Microsoft-Server-ActiveSync?User=mailtest HTTP/1.1 with the following Headers

User-Agent:string
Authorization:Basic  username and password as a Base64 string

I can get this done in Fiddler Web Debugger and get a 200 response but I am having trouble getting this done in Winbatch.

I have set the Headers and url and then used iBegin, iHostConnect and iHTTPInit without getting any errors but when i use iHttpOpen i am receiving an error.
Title: Re: HTTP verbs - OPTIONS
Post by: atlanta1213 on March 06, 2014, 09:23:49 AM
Could this be a job for the WINHTTP object instead?
Title: Re: HTTP verbs - OPTIONS
Post by: Deana on March 06, 2014, 10:03:58 AM
Here are some tech article that might help:

http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/tsleft.web+WinBatch/How~To+HTTP~Authentication.txt
http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/tsleft.web+WinBatch/OLE~COM~ADO~CDO~ADSI~LDAP/WinHttpRequest+Sending~an~API-Key~using~WinHttp.txt
Title: Re: HTTP verbs - OPTIONS
Post by: atlanta1213 on March 06, 2014, 05:56:41 PM
Thanks for the article links - the base64 from clear text UDF will be very helpful.  I guess my issue appears to be the iHttpInit function only accepts two verbs, GET and POST and I need to send OPTIONS.  I will explore the WinHttp options further.
Title: Re: HTTP verbs - OPTIONS
Post by: Deana on March 06, 2014, 08:58:52 PM
Ah now I think I understand. You may want to take a look at the WinInet function iOptionSet. It allows your to specify the

Code (winbatch) Select
user_agent: User Agent for HTTP transfers
username: Server authentication required. Username for iHostConnect
password: Server authentication required. Password for iHostConnect


Title: Re: HTTP verbs - OPTIONS
Post by: atlanta1213 on March 07, 2014, 03:44:20 AM
I was able to get it to work using snippets from the second of your two links.  Using the WinHtttp object allowed me to send a properly formatted OPTIONS request along with the necessary Headers and I was able to return the response headers to Winbatch.  Thanks for all your help. In a nutshell I was trying to connect and verify that a Microsoft Exchange Server's Active Sync (EAS) was listening and responding appropriately.