Can a canister return generated xml?

Even if it did, I don’t know how to get the results of that function just by fetching a url in a browser or curl command. What’s the syntax for calling a canister function by specifying the function name and parameters in the url, similar to how you can use dfx canister call in the terminal? Is that even possible?

I was hoping I could discover the url format by loading up http://127.0.0.1:8000/candid?canisterId= for my canister and pressing the Query button under getXml(), but that sends off a POST request to http://127.0.0.1:8000/api/v1/read with an unintelligible payload:

ÙÙ÷£gcontent¦cargFDIDLkcanister_idRningress_expiryeO!¨¬í€kmethod_namefgetXmllrequest_typeequeryfsenderXí·ïƒ@¥î›Êç0„¶ÆäêKÉð‚msender_pubkeyX óæ#
íü8®Šª@"çǟ†­å´ÞÀÚb¥M¤jsender_sigX@¹¹ä´›µ‰eÎó™yoRŒä\9±žÆÇ'¨y9½D‚–>‘ùëȁpŠ|™ggàóK\\]´0í…Ó<N€(Á

Surely that’s not how I’m supposed to interact with my canister via curl. Is it possible to do so?

I haven’t been able to get the latter idea to work either, using frontend JS to parse and return just the xml. This may be because I’m inexperienced with webpack, but my understand is that the entire SPA gets bundled up into a single JS file. Routing inside the SPA, through React or Mithril or whatever, can do everything I need in terms of parsing the url and preparing the correct xml to return, but it can’t return just the generated xml file. It can modify the DOM and insert the xml content into the body of the page, but that’s not what I need. Again, I have little to no experience with webpack, but afaik it’s impossible to get it to respond to a request with just plain xml, unless that xml is a static file declared in webpack.config.js, which of course it isn’t.

1 Like