I have so far been unsuccessful at trying to resolve this. I have two separate apps. In the URLConnection I am POSTing to a site that does nothing but process POSTs. It writes a response using write.Response (“some answer”). I need to read the response back from the client side. In the documents it says to use URLConnection.ContentReceived That makes sense to me. However, I’m not able to find that option in the drop down and if I force write it in, it generates an error. Any help is appreciated.
ContentReceived is an event you implement.
Assuming you use the generally preferred .Send method (so your UI does not lock up during the request), then as @Thom_McGrath points out you obtain the reply in an event that fires after the server responds.
If you instead use the .SendSync method, the program waits until the server responds (or times out) and the reply is available in the string returned as described in the .SendSync method.
But generally speaking, using .SendSync should be avoided if you want to keep the UI responsive while waiting for a server response.
Oh bummer. OK. I think I see my mistake however… now I’m more confused. My POST is coming from a web page. I see the content received event is available in a desktop version. Is there a way to add that component URLConnection to a webpage? or am I not thinking about this correctly? (sorry didn’t mean to respond to a single person it’s more of a general question)
Best we can do is give general advice. Drag the URLConnection to a web page, and you can implement events on it like a button. Be aware that this will still execute on the server, but it’ll help you organize.
That’s what I would have assumed, but I don’t see it in the Library. I’m running version 2020r2, I looked in version 2019r3 and still didn’t see it in library for a web page.
Afterwards - I tried opening a desktop window next to my WebPage app window and was able to drag it from the Desktop Library onto my WebPage app. I’ll see if I can make that work. Thanks for the help.
To create a URLConnection on a web page drag the generic object from the library and set it’s super to URLConnection