Everything before the question mark is the URL. Everything after the question mark is the POST body, in this case a chunk of XML. Ditch the question mark and use the pieces on either side.
Try and get it working from the command line with curl first. You’re trying to learn both HTTP and Lua and you won’t know which you are making mistakes in.
Spend some time brushing up on HTTP methods; a question mark is used only in HTTP GET. You may be used to web servers where you can sort-of fake a POST with a GET appended with some parameters. This will absolutely not work for most internet-of-things devices.
HTTP POST is not Vera or WeMo specific, so even information you find on Wikipedia about HTTP methods will be relevant.
[quote=“futzle, post:4, topic:190477”]Everything before the question mark is the URL. Everything after the question mark is the POST body, in this case a chunk of XML. Ditch the question mark and use the pieces on either side.
Try and get it working from the command line with curl first. You’re trying to learn both HTTP and Lua and you won’t know which you are making mistakes in.
Spend some time brushing up on HTTP methods; a question mark is used only in HTTP GET. You may be used to web servers where you can sort-of fake a POST with a GET appended with some parameters. This will absolutely not work for most internet-of-things devices.
HTTP POST is not Vera or WeMo specific, so even information you find on Wikipedia about HTTP methods will be relevant.[/quote]
thanks for your assistance
this is the curl i have been trying and code is sent successfully but does not turn off the device.
[quote=“cybrmage, post:6, topic:190477”][quote=“xgutterratx, post:5, topic:190477”]this is the curl i have been trying and code is sent successfully but does not turn off the device.
sorry i dont know what a soap request header is and my goolge search are not helping.
The request is a SOAP request… and would require the SOAP request headers…
You don’t need to know the details to try the new code I included in the post… which has the required SOAP headers already appended…
You obviously don’t understand how the HTTP protocol works… (Don’t take this the wrong way… I’m not trying to be disparaging)…
So… if you want to know the mechanism… read up on it… HTTP - which is the transport layer, and SOAP - which is the application layer.
Basically (TL;DR) - The SOAP specification says that HTTP headers are optional, but some SOAP servers require them… Specifically, in this case, the “SOAPAction” header which helps the server to know what the message/command is, before it receives the SOAP message body with the actual command.
You don’t need to know the details to try the new code I included in the post… which has the required SOAP headers already appended…
You obviously don’t understand how the HTTP protocol works… (Don’t take this the wrong way… I’m not trying to be disparaging)…
So… if you want to know the mechanism… read up on it… HTTP - which is the transport layer, and SOAP - which is the application layer.
Basically (TL;DR) - The SOAP specification says that HTTP headers are optional, but some SOAP servers require them… Specifically, in this case, the “SOAPAction” header which helps the server to know what the message/command is, before it receives the SOAP message body with the actual command.[/quote]
I have sent your command with the headers in the Test lua code section under develop apps and i get a successfull response on screen but it does not turn off the wemo.
Sorry, xgutterratx, I do not think that you will succeed at this. It’s not just that you need to spend days or weeks learning how to escape quoted strings in other quoted strings in a programming language you don’t know or the complicated nature of making UPnP requests over raw HTTP… There are more serious barriers such as the port number (49154 or whatever) being dynamic and chosen partly at random by the WeMo internal web server. No single fixed string will work for the port number long-term. The complexities of UPnP are why the WeMo plugin is hundreds of lines of code in size. No forum member is going to have the patience to teach you Lua and UPnP and debugging techniques from where you are now.
I think that your time would be better spent encouraging Vera Control Ltd to patch the existing WeMo plugin to resolve the problems that you are experiencing. The plugin did once work on earlier UI7 releases so it can’t be insurmountable to fix, and they have my blessing to take my code and change it under the GPL.
Best Home Automation shopping experience. Shop at Ezlo!