Page 1 of 1

user-agent problem

Posted: Tue Apr 11, 2017 4:31 am
by neto_s
hello :)

I asked for a user-agent last week and I have already been noticed that I can use my user-agent

my user-agent works fine in the debugger (http://www.opensubtitles.org/addons/xml-rpc/debugger/) and the test user-agent works fine there too

but in my script both user-agents don't work

I get "414 Unknown User Agent"

Code: Select all

Dim $objHTTP Dim $strEnvelope Dim $strReturn Dim $objReturn Dim $dblTax Dim $strQuery Dim $value ; Initialize COM error handler $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") $objHTTP = ObjCreate("Microsoft.XMLHTTP") $objReturn = ObjCreate("Msxml2.DOMdocument.3.0") $strEnvelope = '<?xml version="1.0"?>' & _ "<methodCall>" & _ "<methodName>LogIn</methodName>" & _ "<param>" & _ "<value><string></string></value>" & _ "</param>" & _ "<param>" & _ "<value><string></string></value>" & _ "</param>" & _ "<param>" & _ "<value><string>en</string></value>" & _ "</param>" & _ "<param>" & _ "<value><string>OSTestUserAgentTemp</string></value>" & _ "</param>" & _ "</methodCall>" ; Set up to post to our local server $objHTTP.open ("post", "http://api.opensubtitles.org/xml-rpc", False) ConsoleWrite("Content of the envelope : "& @CR & $strEnvelope & @CR & @CR) ; Make the 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) 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

Code: Select all

Content of the envelope : <?xml version="1.0"?><methodCall> <methodName>LogIn</methodName> <param><value><string></string></value></param> <param><value><string></string></value></param> <param><value><string>en</string></value></param> <param><value><string>OSTestUserAgentTemp</string></value></param> </methodCall> Return of the SOAP Msg : <?xml version="1.0"?> <methodResponse><params><param><value><struct> <member><name>token</name><value><string>rD1ciXPSBOmeqY6uwy8s--4SJ44</string></value></member> <member><name>status</name><value><string>414 Unknown User Agent</string></value></member> <member><name>seconds</name><value><double>0.008</double></value></member></struct></value></param></params></methodResponse>

Re: user-agent problem

Posted: Tue Apr 11, 2017 1:20 pm
by oss
sending PM

Re: user-agent problem

Posted: Sat Nov 09, 2019 9:22 pm
by neto_s
the problem is when i was creating the evenlop i didnt put the params inside a <params> tag then i got invalid user error

wrong:

<?xml version="1.0"?><methodCall>
<methodName>LogIn</methodName>
<param><value><string></string></value></param>
<param><value><string></string></value></param>
<param><value><string>en</string></value></param>
<param><value><string>OSTestUserAgentTemp</string></value></param>
</methodCall>

right:

<?xml version="1.0"?><methodCall>
<methodName>LogIn</methodName>
<params>
<param><value><string></string></value></param>
<param><value><string></string></value></param>
<param><value><string>en</string></value></param>
<param><value><string>OSTestUserAgentTemp</string></value></param>
</params>
</methodCall>