SOAP webservice in Excel Javascript API

Simon Martyn 1 Reputation point
2023-03-22T19:07:02.7966667+00:00

Is it possible to connect to a SOAP webservice using the Javascript window in Excel?

Based on javascript soap examples I've found I have tried the following without luck.

I'm not familiar with javascript yet so I don't know if it's possible or I just have an error in my code.

function main(workbook: ExcelScript.Workbook) {
   
    var objXMLHttpRequest = new XMLHttpRequest();

    objXMLHttpRequest.open("GET", "http://MXL:7101/MXL/MXLService?wsdl", true);
    

    objXMLHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");

    var packet = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:mxl="http://mxl.com/"> < soapenv: Header/>< soapenv: Body > <mxl: Version />                    </soapenv:Body></soapenv:Envelope>';

    objXMLHttpRequest.send(packet);
    
   let response = objXMLHttpRequest.responseText;
    console.log(response);
  
}


JavaScript API
JavaScript API
An Office service that supports add-ins to interact with objects in Office client applications.
973 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,833 questions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.