I am trying to use the npm-package soap
in my SAPUI5 APP.
I am new to web development, so I tried to follow this tutorial:
https://github.com/SAP-samples/ui5-typescript-tutorial/tree/main/exercises/ex8
What I have tried:
yeoman-generator easy-ui5 ts-app
soap
as a development dependencycreateClient
method into a controller:import { createClient } from "soap"
const SOAPClient:any = createClient("",function(){});
npm start
But I get errors like this in chrome console:
GET http://</resources/http.js net::ERR_ABORTED 404 (Not Found)
loadScript
@ ui5loader.js:1351 2022-05-24 10:39:01.476100 failed to load JavaScript resource: http.js -sap.ui.ModuleSystem
Log.js?eval:452
In the terminal I get messages like:
preferring built-in module
http
over local alternative at/home/user/projects/zvtle.om/node_modules/string_decoder/lib/http.js
, passpreferBuiltins: false
to disable this behavior orpreferBuiltins: true
to disable this warning
In Chrome under sources then resources I can see that the UI5 libraries are loaded, and a soap.js file that has been parsed and now uses sap.ui.definde
. However, all of the packages that soap
would require (such as http
) are not loaded.
I have searched a long time and did not find where I could parse preferBuiltins: true
as mentioned in the terminal output and I am not even sure if that would fix my problems.
the npm package soap
is for Node.js and does not work in a browser. The http
package is a standard Node.js package.
I think the package easy-soap-request
(https://www.npmjs.com/package/easy-soap-request) might fit your need. I have no experience with this package though, but the readme provides an example from the browser.