Clay Posted April 11, 2008 Posted April 11, 2008 (edited) Hey guys, Quick Question: Has anyone ever tried using autoit to retireve data using webservies? I am attempting to do with now. I am trying to access a webservice in order to return some data and manipulate it. Now I have never tried using webservices before and I am faily new to autoit so I am getting confused on two fronts. I have included a snippet of my code below where I am attempting to access the webserive... the result that is returned is 0 or -1 depending which web service I include in the http: path.....could someone please take a look at the code and let me know: 1). if I am missing anything or doing anything wrong in order to access the webservice - is my syntax off? is the script not suffient in order to accomplish what I want? 2) Why I am getting a result of 0 or -1? Note: The web service I am attempting to access does not use SOAP. Also in the snippet below I just included the path to a Microsoft web service... I can not provide the one I am actually trying to access as it contains sensitive data - I hope this does not offend anyone. Dim $objHTTP Dim $objReturn Dim $value Dim $packageQueryUrl= "http://www.microsoft.com/technet/scriptcenter/default.mspx" $objHTTP = ObjCreate("Microsoft.XMLHTTP") $objReturn = ObjCreate("Msxml2.DOMdocument.3.0") $objHTTP.Open("Get", $packageQueryUrl, False ) $objHTTP.Send $value = $objReturn.loadXML($objHTTP.ResponseText) MsgBox(0,"DevCentral Result equals: ", $value) Edited April 11, 2008 by Clay
Clay Posted April 11, 2008 Author Posted April 11, 2008 Ok....no one replied but thanks to all who atleast took a look. Fortunately I was able to solve my issue myself.... so I am just adding a reply to my initial post for the benefit of those who will run into this issue after me. I have included the code below that enabled me to retrieve information from the webservice. 1. Basically this was wrong. loadXML is not required $value = $objReturn.loadXML($objHTTP.ResponseText) 2.An XMLHTTP Object is not required, but it doesn't hurt to keep it in. Below you can find the corrected script Dim $objHTTP Dim $objReturn Dim $Result Dim $packageQueryUrl= "http://www.microsoft.com/technet/scriptcenter/default.mspx" $objHTTP = ObjCreate("Microsoft.XMLHTTP") ;$objReturn = ObjCreate("Msxml2.DOMdocument.3.0") $objHTTP.Open("Get", $packageQueryUrl, False ) $objHTTP.Send $Result = $objHTTP.ResponseText MsgBox(0,"Result equals: ", $Result) I hope this is helpful to someone in the future. Peace !!!!!
PsaltyDS Posted April 11, 2008 Posted April 11, 2008 ...I am just adding a reply to my initial post for the benefit of those who will run into this issue after me.Thanks for posting your resolution. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
ptrex Posted April 12, 2008 Posted April 12, 2008 @Clay I am sorry to say, this is not an example of accessing a webservice !! You just retrieve the source of a webpage. Which is quite a different thing. regards, ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now