Jump to content
GregThompson

SOAP and AutoIT

Recommended Posts

GregThompson

Does anyone have any current, working examples of using AutoIT and working with SOAP/WSDL? I swear I have read EVERYTHING on these forums and tried various things I've found, even just basic basic basic examples... I can't get ANYTHING to work... ? What am I missing out on, I have a basic understanding of the SOAP, and I've been using AutoIT forever... so it's not for a lack of knowledge and I don't even ask for help all that often... I'm juts stumped.

Share this post


Link to post
Share on other sites
GregThompson

Here's an example of what I need to send... currently I'm using the SoapUI program and it works great, but now to get it into AutoIT.. ???

POST http://not.telling.net/UDSM_R11_WebService/mod_gsoap.dll HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: ""
User-Agent: Jakarta Commons-HttpClient/3.1
Host: not.telling.net
Content-Length: 403

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:r11="urn://www.ca.com/Unicenter/DSM/r11">
   <soapenv:Header/>
   <soapenv:Body>
      <r11:Login>
         <r11:userName>winnt://nope/whatever</r11:userName>
         <r11:password>riiiiiight</r11:password>
         <r11:manager>not-telling</r11:manager>
      </r11:Login>
   </soapenv:Body>
</soapenv:Envelope>
Edited by GregThompson

Share this post


Link to post
Share on other sites
GregThompson

I've looked into the XMLDomWrapper... is that even a viable solution to soap post/get and the whole thing?

Share this post


Link to post
Share on other sites
doudou

Download and install MS SOAP Toolkit (google it up).

Then try this:

Dim $SOAPClient
$SOAPClient = ObjCreate("MSSOAP.SOAPClient")

$SOAPClient.mssoapinit("http://www.webservicex.net/country.asmx?wsdl") 
If @error then
    ConsoleWrite($SOAPClient.faultString)
    ConsoleWrite($SOAPClient.detail)
Endif

Dim $cl = $SOAPClient.GetCountries()
$cl = StringReplace($cl, "&lt;" , "<")
$cl = StringReplace($cl, "&gt;" , ">")

Dim $f = FileOpen ("soap-response.xml", 2)
FileWrite($f, $cl)
FileClose($f)

Read toolkit documentation for further details.


UDFS & Apps:


DDEML.au3 - DDE Client + Server[*]
Localization.au3- localize your scripts[*]
TLI.au3 - type information on COM objects (TLBINF emulation)[*]
TLBAutoEnum.au3 - auto-import of COM constants (enums)[*]
AU3Automation - export AU3 scripts via COM interfaces
TypeLibInspector

- OleView was yesterday

Coder's last words before final release: WE APOLOGIZE FOR INCONVENIENCE 

Share this post


Link to post
Share on other sites
ptrex

@GregThompson

This example in the first post is what you are looking for.

http://www.autoitscript.com/forum/index.php?showtopic=45904&st=0#entry342453

@Doudou

Your exmaple does not work, because it does not take care to the values returned.

Rgds,

ptrex

Share this post


Link to post
Share on other sites
doudou

@GregThompson

This example in the first post is what you are looking for.

http://www.autoitscript.com/forum/index.php?showtopic=45904&st=0#entry342453

Yeah, why simple if you can do complicated?!

Manually establishing SOAP session by fiddling with XML is the last thing you should do, if there is a library for exactly this purpose.

@Doudou

Your exmaple does not work, because it does not take care to the values returned.

Ah? What are you talking about? The sample may lack error handling but it is WORKING and a good start. Have you tried it out at all? Do so before bashing other people who try to help.

  • Like 1

UDFS & Apps:


DDEML.au3 - DDE Client + Server[*]
Localization.au3- localize your scripts[*]
TLI.au3 - type information on COM objects (TLBINF emulation)[*]
TLBAutoEnum.au3 - auto-import of COM constants (enums)[*]
AU3Automation - export AU3 scripts via COM interfaces
TypeLibInspector

- OleView was yesterday

Coder's last words before final release: WE APOLOGIZE FOR INCONVENIENCE 

Share this post


Link to post
Share on other sites
adamchapman

@ptrex,

Everytime I run the two lines of code below:

$SOAPClient = objcreate("MSSOAP.SOAPClient")
$SOAPClient.mssoapinit('https://api.betfair.com/global/v3/BFGlobalService.wsdl')

I receive an error on the 2nd line:

 ==> Variable must be of type "Object".

I guess the object  

The SOAP toolkit I downloaded and installed is from http://www.microsoft.com/en-gb/download/details.aspx?id=7043 .

I wonder if this is the same version you are using, and if you had to add anything to your classpath in order to get this to run from autoit?

I'm running WIndows 7 Home Premium, service pack 1 if that clarifies anything.

I you have any ideas to get this running I'd be very grateful

Adam

Share this post


Link to post
Share on other sites
water

Add a COM error handler for detailed error information. An example can be found in the help file for ObjEvent.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
adamchapman

Thanks for the fast response water.

 I read that the object with version 3.0 of MSSOAP should be called "MSSOAP.SoapClient30", so updated my code and added an error handler:

$oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc")

$SOAPClient = ObjCreate("MSSOAP.SoapClient30")


$SOAPClient.mssoapinit('http://localhost/Webservice/WS_HelloWorld.asmx?wsdl') 

#forceref $oErrorHandler, $oIEEvents


; User's COM error function. Will be called if COM error occurs
Func _ErrFunc($oError)
    ; Do anything here.
    ConsoleWrite("err.number is: " & @TAB & $oError.number & @CRLF & _
   "err.windescription:" & @TAB & $oError.windescription & @CRLF & _
   "err.description is: " & @TAB & $oError.description & @CRLF & _
   "err.source is: " & @TAB & $oError.source & @CRLF & _
   "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _
   "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _
   "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _
   "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _
   "err.retcode is: " & @TAB & $oError.retcode & @CRLF & @CRLF)
EndFunc   ;==>_ErrFunc

the error returned is:

err.number is:  -2147221005
err.windescription: Invalid class string

err.description is:  
err.source is:  
err.helpfile is:  
err.helpcontext is:  15832000
err.lastdllerror is:  1008
err.scriptline is:  5
err.retcode is:  15834960

err.number is:  169
err.windescription: Variable must be of type 'Object'.
err.description is:  
err.source is:  
err.helpfile is:  
err.helpcontext is:  15832000
err.lastdllerror is:  0
err.scriptline is:  8
err.retcode is:  15834960

 

Thanks for taking a look

Adam

Share this post


Link to post
Share on other sites
adamchapman

- The call to "ObjCreate" returned zero, so was unsuccessful :(

Share this post


Link to post
Share on other sites
water

Either installsation of the soap toolkit was not succesfull or the mname of the object is wrong.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×