Jump to content
Sign in to follow this  


Recommended Posts


Hi, I'm trying to connect to a xml-rpc server (for a game), but it just won't work.

I don't see a reason why, I got all the headers, I have the right xml code (I think).

Could someone take a look at this, please?

Dim $objHTTP
Dim $strEnvelope
Dim $strReturn
Dim $objReturn
Dim $dblTax
Dim $strQuery
Dim $value

$sIP = ""
$iPort = 5001

; Initialize COM error handler
$oMyError = ObjEvent("AutoIt.Error","MyErrFunc")

$objHTTP = ObjCreate("Microsoft.XMLHTTP")
$objReturn = ObjCreate("Msxml2.DOMdocument.3.0")

; Create the SOAP Envelope
$strEnvelope = "<?xml version=""1.0""?>" & _
"<methodCall>" & _
   "<methodName>system.listMethods</methodName>" & _

; Set up to post to our local server
$objHTTP.open ("post", "http://"&$sIP&":"&$iPort, False)

; Set a standard SOAP/ XML header for the content-type
$objHTTP.setRequestHeader ("Content-Type", "text/xml")
$objHTTP.setRequestHeader ("Content-length", StringLen($strEnvelope))
$objHTTP.setRequestHeader ("User-Agent", "GBX Remote 2")
$objHTTP.setRequestHeader ("Host", $sIP)

; 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","Return  : " & $Soap)

Func MyErrFunc()
  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

Share this post

Link to post
Share on other sites

I made an other script, it uses tcp to connect to the server.

When it connects, it receives this: (it receives something, jeeeh! :) )


GBXRemote 2

I don't know what 0x0B000000 is supposed to mean? muttley

It still doesn't work, after the stuff I received it doenst return anything, but i really send "system.listMethods" (which should return a list of all possible methods)

Can somebody say what's wrong with it? Maybe a wrong http header? or xml.


Global $I_UNITED = 0
Global $I_FOREVER = 1


Global $sIP = ""
Global $iPort = 5001

Global $hSocket  = TCPConnect($sIP, $iPort)

If not @error Then
    ConsoleWrite("<KSC> -Message- Connected to server."&@CRLF)
    ConsoleWrite("<KSC> -Message- Unable to connect to the server."&@CRLF)

Global $sHTTP = "POST /RPC2 HTTP/1.1" &@LF& _
"User-Agent: MyAgent" &@LF& _
"Host: "&$sIP &@LF& _
"Content-Type: text/xml" &@LF& _
"Content-length: %iLen%" &@CRLF

Global $sXML = "<?xml version=""1.0""?>" & _
"<methodCall>" & _
   "<methodName>%sMethod%</methodName>" & _
   "<params>" & _
      "</params>" & _

$sTempXML = StringReplace($sXML, "%sMethod%", "system.listMethods")
$sTempHTTP = StringReplace($sHTTP, "%iLen%", StringLen($sTempXML))

TCPSend($hSocket,$sHTTP & $sTempXML)

While 1
    $sRecv = TCPRecv($hSocket, 1024)
    If $sRecv Then ConsoleWrite("<KSC> -Return- "&$sRecv&@CRLF)

Func Terminate()
    While 1

Share this post

Link to post
Share on other sites

Your header isn't correct. It should be separated with CRLF and end with double line muttley

Global $sHTTP = "POST /RPC2 HTTP/1.1" &@CRLF& _
"User-Agent: MyAgent" &@CRLF& _
"Host: "&$sIP &@CRLF& _
"Content-Type: text/xml" &@CRLF& _
"Content-length: %iLen%" &@CRLF&@CRLF

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

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

Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.