0

Pre-first, VBScript is obviously an obsolete language.

First, I'm limited to VBScript because the script runs inside the Seagull Scientific BarTender 10.1 label printing app. I cannot install modules with NuGet or similar.

In VBScript, how is an XML-RPC request constructed and sent? The request is a combination of XML and HTTP headers. What is required to format a XML-RPC request in VBScript, and what is required to convert the response XML to an object, similarly to the Python example below.

In Python

models = xmlrpc.client.ServerProxy('{}/xmlrpc/2/object'.format(url))
models.execute_kw(db, uid, password,
    'res.partner', 'check_access_rights',
    ['read'], {'raise_exception': False})

My attempt in VBScript

Dim xmlRpcRequest, endpoint, method

Set xmlRpcRequest = CreateObject("Msxml2.XMLHTTP.6.0") 
endpoint = "https://1.erp.practichem.dev/xmlrpc/2/common"
xmlReq = "execute_kw"
xmlRpcRequest.open "GET", endpoint, false
xmlRpcRequest.send

msgbox() = xmlRpcRequest.responseText
ndemarco
  • 209
  • 2
  • 12
  • 1
    Does this answer your question? [Loading XML file from httprequest output](https://stackoverflow.com/q/37339797) – user692942 Aug 06 '21 at 19:27
  • 1
    Try not to ask too many questions as [so] questions should be specific problems not how to do this then do this. Asking multiple questions in the same question will lead to the question being closed as "Too broad". – user692942 Aug 06 '21 at 19:29
  • 1
    @user692942, I had seen both before. I'm already doing what is shown in the first (HTTP GET), but I must also send the method `execute_kw`, which is abstracted in the Python class. The second (Loading XML...) will be extremely helpful, thank you. – ndemarco Aug 07 '21 at 02:09
  • I am hoping there's some COM object or similar inbuilt functionality for VB for encoding a structure into XML-RPC – ndemarco Aug 07 '21 at 02:10
  • No, VBScript first came on the scene in 1996 followed by XML-RPC in 1998. There is no built-in support to parse XML-RPC structures but VBScript does give you the tools to build a parser yourself using the MSXML COM library. – user692942 Aug 07 '21 at 12:50
  • @user692942, My question is not the same as "HTTP GET in VBS." HTTP GET is a method. XML-RPC is a remote procedure call language. Don't mark them as duplicate. SO exists to assist people with questions. You've shot down my question. – ndemarco Aug 13 '21 at 11:23
  • Not shooting you down, it's just VBScript pre-dates XML-RPC so there is no "built-in" support for it. But, it does have support for XHR requests (which [the duplicate](https://stackoverflow.com/questions/204759/http-get-in-vbs) deals with) and the ability to parse XML responses. In basic terms, XML-RPC is still a type of XML response (see the [second duplicate question](https://stackoverflow.com/q/37339797)), it's up to you to parse it as a valid XML-RPC structure. – user692942 Aug 13 '21 at 11:30
  • As a side note the line `msgbox() = xmlRpcRequest.responseText` is invalid syntax, you probably wanted `msgbox xmlRpcRequest.responseText` see the [`MsgBox()` function](https://learn.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/scripting-articles/sfw6660x(v=vs.84)) for more info. – user692942 Aug 13 '21 at 11:34

0 Answers0