I am still learning the ins and outs of the Homepages Widgets SDK, as well as Angular, so please excuse me if the question is silly.
As a learning experience (after going through the samples and creating a few 'hello world'-style widgets, I am attempting to interface with LN through ION. I was able to retrieve data with the `executeIonApiAsync()` function and am getting proper replies.
The issue is that this particular service (LN HoursRegistration API) only supports SOAP for communication. I attempted to use the `@types/xml2js` module to parse the SOAP reply into something I can use in TypeScript, but have encountered a problem.
When running the widget in the development environment, I get this in the console:
zone.min.js:1 GET http://localhost:8080/xml2js 404 (Not Found)lime-main.js:1 [15:52:46,751] [ERROR] [WidgetService] Error: Fetch error: 404 Not Found
Similarly, when attempting to package the widget, I get:
Begin: Bundle with SystemJS Builder...Created bundle script file: Widgets/_lime_temp_1569594870632/bundle-aot.jsChanged working directory to: /home/user/projects/Infor_HomepagesWidgetSDK/Samples/Widgets/_lime_temp_1569594870632Executing: node ./bundle-aot.jsUnhandled rejection Error on fetch for xml2js at file:///home/user/projects/Infor_HomepagesWidgetSDK/Samples/Widgets/_lime_temp_1569594870632/xml2js Loading snt.hoursregistration/services/week.data.js Loading snt.hoursregistration/main.js Loading snt.hoursregistration/widget-aot.js Error: ENOENT: no such file or directory, open '/home/user/projects/Infor_HomepagesWidgetSDK/Samples/Widgets/_lime_temp_1569594870632/xml2js'
(The widget works fine if I remove the xml2js import, but I assume that would mean I have to implement my own XML parsing, which does not particularly appeal to me.)
Am I correct in assuming that I cannot add extra node modules to my widget? Or have I missed some configuration step somewhere?
If node modules cannot be added, how would I go about consuming a SOAP reply in XML from APIs which do not support JSON? Or is there XML/SOAP support in lime or soho, which I somehow missed? (I searched the documentation pages, the GitHub page for the Homepages SDK and the community site.)
Thank you in advance!
It seems I have missed that in the documentation, apologies. In case anyone else has a similar question, the following seems to work as a quick&dirty test:
In the imports section:
declare var $: JQueryStatic;
then, when reading a soap response:
const xmlDoc = $.parseXML(iar.data);const xml = $( xmlDoc );const headerStart = xml.find("HeaderStartDate").text();const headerEnd = xml.find("HeaderEndDate").text();