ptrex Posted May 13, 2007 Share Posted May 13, 2007 (edited) Simple SOAP Example For those who don't know what SOAP (Simple Object Access Protocol) is. SOAP is a simple XML-based protocol to let applications exchange information over HTTP, and is platform independend. An advantage of SOAP is that program calls are much more likely to get through firewall servers that screen out requests other than those for known applications (through the designated port mechanism). Since HTTP requests are usually allowed through firewalls, programs using SOAP to communicate can be sure that they can communicate with programs anywhere. In this SOAP example, you will learn what SOAP is, and how it uses XML to exchange information between applications. The next step will be, how to turn AU3 into a Web Services server. This is the SOAP CLIENT expandcollapse popupDim $objHTTP Dim $strEnvelope Dim $strReturn Dim $objReturn Dim $dblTax Dim $strQuery Dim $value $value = InputBox("Testing", "Enter your new value here.", 10) ; Initialize COM error handler $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") $objHTTP = ObjCreate("Microsoft.XMLHTTP") $objReturn = ObjCreate("Msxml2.DOMdocument.3.0") ; Create the SOAP Envelope $strEnvelope = "<soap:envelope xmlns:soap=""urn:schemas-xmlsoap-org:soap.v1"">" & _ "<soap:header></soap:header>" & _ "<soap:body>" & _ "<m:getsalestax xmlns:m=""urn:myserver/soap:TaxCalculator"">" & _ "<salestotal>"&$value&"</salestotal>" & _ "</m:getsalestax>" & _ "</soap:body>" & _ "</soap:envelope>" ; Set up to post to our local server $objHTTP.open ("post", "http://localhost/soap.asp", False) ; Set a standard SOAP/ XML header for the content-type $objHTTP.setRequestHeader ("Content-Type", "text/xml") ; Set a header for the method to be called $objHTTP.setRequestHeader ("SOAPMethodName", "urn:myserver/soap:TaxCalculator#getsalestax") ConsoleWrite("Content of the Soap envelope : "& @CR & $strEnvelope & @CR & @CR) ; Make the SOAP call $objHTTP.send ($strEnvelope) ; Get the return envelope $strReturn = $objHTTP.responseText ; ConsoleWrite("Debug : "& $strReturn & @CR & @CR) ; Load the return envelope into a DOM $objReturn.loadXML ($strReturn) ConsoleWrite("Return of the SOAP Msg : " & @CR & $objReturn.XML & @CR & @CR) ; Query the return envelope $strQuery = "SOAP:Envelope/SOAP:Body/m:getsalestaxresponse/salestax" $dblTax = $objReturn.selectSingleNode($strQuery) $Soap = $objReturn.Text MsgBox(0,"SOAP Response","The Sales Tax is : " & $Soap) Func MyErrFunc() $HexNumber=hex($oMyError.number,8) Msgbox(0,"COM Test","We intercepted a COM Error !" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $oMyError.description & @CRLF & _ "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _ "err.number is: " & @TAB & $HexNumber & @CRLF & _ "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _ "err.source is: " & @TAB & $oMyError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oMyError.helpcontext _ ) SetError(1) ; to check for after this function returns Endfunc This is the SOAP SERVER expandcollapse popup<% Dim oNode Set objReq = Server.CreateObject("Msxml2.DOMdocument.3.0") 'Load the request into XML DOM objReq.Load Request 'Query the DOM for the input parameter ' Remember: xpath is case sensitive. "SalesTotal" is not the same as "salestotal" strQuery = "SOAP:Envelope/SOAP:Body/m:getsalestax/salestotal" 'varSalesTotal = objReq.SelectSingleNode(strQuery).Text Set oNode = Nothing Set oNode = objReq.SelectSingleNode(strQuery) if not oNode is Nothing Then varSalesTotal = oNode.Text else 'handle the error - save the xml to a file so you can look at it varSalesTotal = objReq.Text end if 'Calculate the sales tax varSalesTax = varSalesTotal * 0.04 'Prepare the return envelope strTmp = _ "<soap:envelope xmlns:soap=""urn:schemas-xmlsoap-org:soap.v1"">" & _ "<soap:header></soap:header>" & _ "<soap:body>" & _ "<m:getsalestaxresponse xmlns:m=""urn:myserver/soap:Taxcalc"">" & _ "<salestax>" & varSalesTax & "</salestax>" & _ "</m:getsalestaxresponse>" & _ "</soap:body>" & _ "</soap:envelope>" 'Write the return envelope Response.Write strTmp %> Save the SOAP SERVER as SOAP.asp and put it in the root of your IIS server. Run the client and see what happenes. Enjoy !! Regards ptrex Edited September 14, 2012 by ptrex guner7, mLipok and ds2kx 2 1 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 Link to comment Share on other sites More sharing options...
ptrex Posted May 13, 2007 Author Share Posted May 13, 2007 (edited) @all OK this is an Example connecting to a Web Service collecting the MS stock information. expandcollapse popupDim $oMyError, $xmlFile, $oNode, $strReturn, $objReq $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") $xmlDoc= ObjCreate("Msxml2.DOMdocument.3.0") $SOAPClient = objcreate("MSSOAP.SOAPClient") $SOAPClient.mssoapinit ("http://www.webservicex.net/stockquote.asmx?WSDL") $strReturn = $SOAPClient.GetQuote("MSFT") ConsoleWrite( "MSFT : " & $strReturn & @CRLF & @CRLF) $xmlDoc.loadXML ($strReturn) $oNode = $xmlDoc.selectSingleNode("StockQuotes") ConsoleWrite($oNode.text & @CRLF & @CRLF) ;This is COM error handler Func MyErrFunc() $HexNumber=hex($oMyError.number,8) Msgbox(0,"COM Error Test","We intercepted a COM Error !" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $oMyError.description & @CRLF & _ "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _ "err.number is: " & @TAB & $HexNumber & @CRLF & _ "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _ "err.source is: " & @TAB & $oMyError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oMyError.helpcontext _ ) SetError(1) ; to check for after this function returns Endfunc oÝ÷ ØgXsJ)ߢ¹¶*'jëh×6Dim $oMyError $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") dim $SOAPClient $SOAPClient = ObjCreate("MSSOAP.SOAPClient") $SOAPClient.mssoapinit("http://www.webservicex.net/whois.asmx?wsdl") if @error then ConsoleWrite( $SOAPClient.faultString) ConsoleWrite( $SOAPClient.detail) Endif ConsoleWrite($SOAPClient.GetWhois("autoitscript.com")) if @error then ConsoleWrite($SOAPClient.faultString) ConsoleWrite($SOAPClient.detail) endif ;This is COM error handler Func MyErrFunc() $HexNumber=hex($oMyError.number,8) Msgbox(0,"COM Error Test","We intercepted a COM Error !" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $oMyError.description & @CRLF & _ "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _ "err.number is: " & @TAB & $HexNumber & @CRLF & _ "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _ "err.source is: " & @TAB & $oMyError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oMyError.helpcontext _ ) SetError(1) ; to check for after this function returns EndfuncoÝ÷ Ù8b²ÞÁ¶Ø§©e §¶¸±«¢+Ù¥´ÀÌØí½5åÉɽÈ(ÀÌØí½5åÉɽÈô=©Ù¹Ð ÅÕ½ÐíÕѽ%йÉɽÈÅÕ½Ðì°ÅÕ½Ðí5åÉÉÕ¹ÅÕ½Ðì¤()¥´ÀÌØíM=A ±¥¹Ð(ÀÌØíM=A ±¥¹Ðô=© ÉÑ ÅÕ½Ðí5MM=@¹M=A ±¥¹ÐÅÕ½Ðì¤((ÀÌØíM=A ±¥¹Ð¹µÍͽÁ¥¹¥Ð ÅÕ½Ðí¡ÑÑÀè¼½ÝÝܹÝÍÉ٥๹н½Õ¹ÑÉä¹ÍµàýÝÍ°ÅÕ½Ðì¤(¥ÉɽÈÑ¡¸( ½¹Í½±]É¥Ñ ÀÌØíM=A ±¥¹Ð¹Õ±ÑMÑÉ¥¹¤( ½¹Í½±]É¥Ñ ÀÌØíM=A ±¥¹Ð¹Ñ¥°¤(¹¥) ½¹Í½±]É¥Ñ ÀÌØíM=A ±¥¹Ð¹Ñ ½Õ¹ÑÉ¥Ì ¤¤(¥ÉɽÈÑ¡¸( ½¹Í½±]É¥Ñ ÀÌØíM=A ±¥¹Ð¹Õ±ÑMÑÉ¥¹¤( ½¹Í½±]É¥Ñ ÀÌØíM=A ±¥¹Ð¹Ñ¥°¤(¹¥((íQ¡¥Ì¥Ì =4Éɽȡ¹±È)Õ¹5åÉÉÕ¹ ¤(ÀÌØí!á9ÕµÈõ¡à ÀÌØí½5åÉɽȹ¹ÕµÈ°à¤(5ͽà À°ÅÕ½Ðí =4ÉɽÈQÍÐÅÕ½Ðì°ÅÕ½Ðí]¥¹ÑÉÁÑ =4ÉɽÈÌÌìÅÕ½ÐìµÀì I1µÀì I1µÀì|($$$ÅÕ½ÐíÉȹÍÉ¥ÁÑ¥½¸¥ÌèÅÕ½ÐìµÀìQµÀìÀÌØí½5åÉɽȹÍÉ¥ÁÑ¥½¸µÀì I1µÀì|($$$ÅÕ½ÐíÉȹݥ¹ÍÉ¥ÁÑ¥½¸èÅÕ½ÐìµÀìQµÀìÀÌØí½5åÉɽȹݥ¹ÍÉ¥ÁÑ¥½¸µÀì I1µÀì|($$$ÅÕ½ÐíÉȹ¹ÕµÈ¥ÌèÅÕ½ÐìµÀìQµÀìÀÌØí!á9յȵÀì I1µÀì|($$$ÅÕ½ÐíÉȹ±Íѱ±ÉɽȥÌèÅÕ½ÐìµÀìQµÀìÀÌØí½5åÉɽȹ±Íѱ±ÉɽȵÀì I1µÀì|($$$ÅÕ½ÐíÉȹÍÉ¥Áѱ¥¹¥ÌèÅÕ½ÐìµÀìQµÀìÀÌØí½5åÉɽȹÍÉ¥Áѱ¥¹µÀì I1µÀì|($$$ÅÕ½ÐíÉȹͽÕÉ¥ÌèÅÕ½ÐìµÀìQµÀìÀÌØí½5åÉɽȹͽÕɵÀì I1µÀì|($$$ÅÕ½ÐíÉȹ¡±Á¥±¥ÌèÅÕ½ÐìµÀìQµÀìÀÌØí½5åÉɽȹ¡±Á¥±µÀì I1µÀì|($$$ÅÕ½ÐíÉȹ¡±Á½¹ÑáÐ¥ÌèÅÕ½ÐìµÀìQµÀìÀÌØí½5åÉɽȹ¡±Á½¹ÑáÐ|($$$¤(MÑÉÉ½È Ä¤ìѼ¡¬½ÈÑÈÑ¡¥Ìչѥ½¸ÉÑÕɹÌ)¹Õ¹ Regards, ptrex Edited May 14, 2007 by ptrex SEuBo 1 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 Link to comment Share on other sites More sharing options...
Apzo Posted May 14, 2007 Share Posted May 14, 2007 Awesome (once more), Ptrex ! Do you have any idea yet for the AU3 server part ? Apzo. All the pop3 functions.Rsync your files on your USB key (or anywhere else) Link to comment Share on other sites More sharing options...
ptrex Posted May 14, 2007 Author Share Posted May 14, 2007 @ApzoThanks !!Do you have any idea yet for the AU3 server partYes I do, but I need to find the time to do some more testing.I got the framework up and running but I did not get the Client to communicate with the server yet.I'll be in touch when I got a hit.Regardsptrex 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 Link to comment Share on other sites More sharing options...
ptrex Posted May 14, 2007 Author Share Posted May 14, 2007 @all I have added 2 new Web Services to the 2nd post. Get WHOIS information and Get All Countries. Just a mapper of example what it can do. 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 Link to comment Share on other sites More sharing options...
BillLuvsU Posted May 14, 2007 Share Posted May 14, 2007 This is seriously awesome, great work man! [center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw Link to comment Share on other sites More sharing options...
ptrex Posted May 14, 2007 Author Share Posted May 14, 2007 @fear1313 Thanks !! Keep you all posted when I got more news. 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 Link to comment Share on other sites More sharing options...
Jazkal Posted November 1, 2007 Share Posted November 1, 2007 Did you ever get anywhere with the AU3 server side? Link to comment Share on other sites More sharing options...
Toady Posted November 1, 2007 Share Posted November 1, 2007 Wow very nice! I can use this at work in testing my current project. www.itoady.com A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding Link to comment Share on other sites More sharing options...
ptrex Posted November 3, 2007 Author Share Posted November 3, 2007 @JazkalI started using the Soap ToolkitBut I didn't put a lot effort in this because it has be declared obsolete by MS.These days they only support .NET webservices. And this is a different ballgame.There are other ways of making a webservice server as well using for instance PHP. But I never used that.Maybe some others like "Toady" can guide us in the better direction on what the best tool to start using the Server Side Webservices.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 Link to comment Share on other sites More sharing options...
Jazkal Posted November 4, 2007 Share Posted November 4, 2007 Thanks again for the info. Maybe you know of something else that would meet my needs? I'm looking to run an Autoit app on a 'server', and pass it commands or info (to do things with) from 'client' machines. Know of any UDF's or whatever that would handle this? Thanks Link to comment Share on other sites More sharing options...
ConsultingJoe Posted November 4, 2007 Share Posted November 4, 2007 So can you use Microsoft.XMLHTTP to send http requests instead of HTTP.au3 where that uses tcpsend(). That way windows would manage the requests. Check out ConsultingJoe.com Link to comment Share on other sites More sharing options...
ptrex Posted November 13, 2007 Author Share Posted November 13, 2007 (edited) @CyberZeroCool Yes you can as shown in my first post and first example. Look for $objHTTP = ObjCreate("Microsoft.XMLHTTP") But it is more labour intensive to do so. Because you have to assemble the SOAP message by hand. regards, ptrex Edited November 13, 2007 by 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 Link to comment Share on other sites More sharing options...
ConsultingJoe Posted November 13, 2007 Share Posted November 13, 2007 @CyberZeroCool Yes you can as shown in my first post and first example. Look for $objHTTP = ObjCreate("Microsoft.XMLHTTP") But it is more labour intensive to do so. Because you have to assemble the SOAP message by hand. regards, ptrexthanks Check out ConsultingJoe.com Link to comment Share on other sites More sharing options...
Toady Posted November 13, 2007 Share Posted November 13, 2007 Here is a very basic example using .Net and XMLHTTP. No special SOAP syntax required. First is your VB ASP.NET page, see below. MyService.aspx <%@ Page Language="VB" %> <script runat="server"> Sub Page_Load() Response.Expires = -1 Response.ContentType = "text/xml" Dim strNL As String = Chr(13) & Chr(10) Dim MyCompany As String = Request.QueryString("CompanyName") Dim XMLContent As String = "<?xml version='1.0'?><MyCompany>" & strNL XMLContent += "<Address>342 West Corban Ln</Address>" & strNL XMLContent += "<Employees>" & strNL XMLContent += "<Manager>Joe Smith</Manager>" & strNL XMLContent += "<Programmer>Jane Smith</Programmer>" & strNL XMLContent += "</Employees>" & strNL XMLContent += "</MyCompany>" & strNL Response.Write(XMLContent) Response.End() End Sub </script> Then your AU3 code to make request and parse XML response. This way you can pass a query string to the service to do database gathering if you like. From this you can see how easily it can be expanded to something more extravagant. I took out the MyErrFunc() to make it easier to read. MyScript.au3 Dim $objXMLHTTP = ObjCreate("Microsoft.XMLHTTP") Dim $objReturn = ObjCreate("Msxml2.DOMdocument.3.0") Dim $XMLDoc, $itemsDoc $objReturn.async = "false" $objXMLHTTP.open("GET","http://localhost/MyService.aspx?CompanyName=McDonalds",true) $objXMLHTTP.send("") $strReturn = $objXMLHTTP.responseText $objReturn.loadXML($strReturn) $itemsDoc = $objReturn.documentElement MsgBox(0,"","Address=" & $itemsDoc.childNodes(0).childNodes(0).nodeValue & @CRLF & _ "Manager=" & $itemsDoc.childNodes(1).childNodes(0).childNodes(0).nodeValue & @CRLF & _ "Programmer=" & $itemsDoc.childNodes(1).childNodes(1).childNodes(0).nodeValue ) www.itoady.com A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding Link to comment Share on other sites More sharing options...
ptrex Posted November 14, 2007 Author Share Posted November 14, 2007 @ToadyThanks for your input. But this example is not realy a SOAP example.It just reads out some XML in a webpage. SOAP uses XML that's correct but there' s a bit more to it.SOAP SyntaxRegards,Patrick 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 Link to comment Share on other sites More sharing options...
Toady Posted November 14, 2007 Share Posted November 14, 2007 ... well just my 2 cents. www.itoady.com A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding Link to comment Share on other sites More sharing options...
Gigglestick Posted April 8, 2008 Share Posted April 8, 2008 I have never used SOAP before, and it's been several years since I did anything with Sharepoint. I've been trying to figure this out in relation to Sharepoint, and I'm sure I'm just overthinking it. Has anyone used SOAP in AutoIt to interact with Sharepoint? Do you have any examples? Basically, I'm trying to pull data from a Sharepoint database, such as a list of machine names to do something to, and possibly to push data back into another database in Sharepoint. I been using a SQL database for this, but the front end for this tool was designed in VB and is obsolete, and we do not have an approved SQL management tool, so I'm looking to either query the Sharepoint front end or possibly the SQL database behind it as long as that doesn't cause issues with the front end. Then Sharepoint could be used as the front end to the database. Thoughts? Examples? My UDFs: ExitCodes Link to comment Share on other sites More sharing options...
ptrex Posted April 9, 2008 Author Share Posted April 9, 2008 (edited) @c0deWormI have walked down that road to myself.The first attempt was to use Some kind of translated Vbscript code, to access the sharepoint. I never got far. Anyhow you will have to use these two objects to start going :Reporting Services Sharepointexpandcollapse popup$xmlHTTP=ObjCreate("MSXML2.xmlHTTP.3.0") $objStream = ObjCreate("ADODB.Stream")oÝ÷ Ù8b²+#=ìZ^¶¶ËZ®×jëh×6; Initialize COM error handler $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") $strEndPointURL = "https://your server/global/Lists/AllItems.aspx" $strListName = "{47327AF9-9E3F-4171-A48A-9F0CA4D467F6}" $strSoapAction="http://schemas.microsoft.com/sharepoint/soap/GetListItems" $objSOAPConnector = ObjCreate("MSOSOAP.HttpConnector30") with $objSOAPConnector .Property("EndPointURL") = $strEndPointURL .Property("SoapAction") = $strSoapAction .Connect() EndWith $objSOAPSerializer = ObjCreate("MSOSoap.SoapSerializer30") with $objSOAPSerializer .Init($objSOAPConnector.InputStream) .startEnvelope() .startBody() .StartElement ("GetListItems", "http://schemas.microsoft.com/sharepoint/soap/") .StartElement ("listName", "http://schemas.microsoft.com/sharepoint/soap/") .WriteString($strListName) .EndElement() .StartElement ("rowLimit", "http://schemas.microsoft.com/sharepoint/soap/") .WriteString("10") .EndElement() .EndElement() .endBody() .endEnvelope() EndWith $objSOAPConnector.EndMessage() $objResponseReader = ObjCreate("MSOSOAP.SoapReader30") $objResponseReader.Load($objSOAPConnector.OutputStream) Consolewrite ($objResponseReader.Body.xml) Func MyErrFunc() $HexNumber=hex($oMyError.number,8) Msgbox(0,"COM Test","We intercepted a COM Error !" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $oMyError.description & @CRLF & _ "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _ "err.number is: " & @TAB & $HexNumber & @CRLF & _ "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _ "err.source is: " & @TAB & $oMyError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oMyError.helpcontext _ ) SetError(1) ; to check for after this function returns EndfuncYou can make an AU3 script ,that accesses the Excel sheet that cantains that linked WSS list.Using normal COM scripting.I hope this saves you some time to get you going.Regards,ptrex Edited April 9, 2008 by 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 Link to comment Share on other sites More sharing options...
cloud9ine Posted December 15, 2008 Share Posted December 15, 2008 I am fairly new to SOAP but have worked quite a bit on AutoIt. I have a possibly stupid question, but in your client, say, the MSFT Stock Quote client, the response string is: CODEMSFT : <StockQuotes><Stock><Symbol>MSFT</Symbol><Last>19.07</Last><Date>12/15/2008</Date><Time>9:53am</Time><Change>-0.29</Change><Open>19.33</Open><High>19.44</High><Low>19.01</Low><Volume>4317804</Volume><MktCap>171.2B</MktCap><PreviousClose>19.36</PreviousClose><PercentageChange>-1.50%</PercentageChange><AnnRange>17.50 - 36.72</AnnRange><Earns>1.892</Earns><P-E>10.23</P-E><Name>Microsoft Corpora</Name></Stock></StockQuotes> What is the method other than manual parsing to get, say, just the earnings of the stock, or say, the percentage change. I mean, one of the lowest level items. How do I address down to one of these and get the data? Anil Link to comment Share on other sites More sharing options...
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