Need help converting a CURL call to a Tasker HTTP Post Task

1,821 views
Skip to first unread message

Roberto Fabrizi

unread,
Dec 10, 2014, 2:46:00 PM12/10/14
to tas...@googlegroups.com
Hello everyone, I've been trying to convert this working wemo switch curl call to a Tasker HTTP Post Task, but sadly I can't seem to do it...
The working call is:

curl -0 -A '' -X POST -H 'Accept: ' -H 'Content-type: text/xml; charset=utf-8' -H SOAPACTION: "urn:Belkin:service:basicevent:1#GetBinaryState" --data '<?xml version=1.0 encoding=utf-8?><s:Envelope xmlns:s=http://schemas.xmlsoap.org/soap/envelope/ s:encodingStyle=http://schemas.xmlsoap.org/soap/encoding/><s:Body><u:GetBinaryState xmlns:u=urn:Belkin:service:basicevent:1><BinaryState>1</BinaryState></u:GetBinaryState></s:Body></s:Envelope>' -s http://192.168.1.11:49154/upnp/control/basicevent1

I've created a Http Post that has the following:
Server:Port =192.168.1.11:49154
Path = upnp/control/basicevent1
Data / File = <?xml version=1.0 encoding=utf-8?><s:Envelope xmlns:s=http://schemas.xmlsoap.org/soap/envelope/ s:encodingStyle=http://schemas.xmlsoap.org/soap/encoding/><s:Body><u:GetBinaryState xmlns:u=urn:Belkin:service:basicevent:1><BinaryState>1</BinaryState></u:GetBinaryState></s:Body></s:Envelope>
Content Type = Content-type: text/xml; charset="utf-8" SOAPACTION: "urn:Belkin:service:basicevent:1#GetBinaryState"

But I get an exception when I try to run it:


Can you help me fix what I'm doing wrong?
Thank you so much!!!

Rob

Roberto Fabrizi

unread,
Dec 13, 2014, 8:27:18 AM12/13/14
to tas...@googlegroups.com
Fixed my issues by using this plug in https://play.google.com/store/apps/details?id=com.freehaha.restask
Much more intuitive than Tasker's default http post.

Terence Yung

unread,
Jan 20, 2015, 12:27:53 PM1/20/15
to tas...@googlegroups.com
Hi,

Could you elaborate how did you setup the post request in restask?

I am trying to do send a soap body but don't know where to input the soap body inside REStask.

Thankyou

Mark H

unread,
Jul 14, 2016, 11:37:28 AM7/14/16
to Tasker
I know I'm very late to the party but I thought I'd post my solution here as I got this working a couple of days ago using RESTask and couldn't find the answer elsewhere. Pay special attention to what is and what isn't in speech marks.

NB Obviously you'll need to change the IP address to match your WEMO and check which port it's working on 49152,49153 or 49154 by trial and error. The chrome extension "Boomerang - SOAP & REST Client" is very useful to get it working first before putting it into RESTask
Basic tab:

Request Type: POST
Custom body:
<?xml version=1.0 encoding="utf-8"?> <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <s:Body><u:SetBinaryState xmlns:u="urn:Belkin:service:basicevent:1"><BinaryState>1</BinaryState></u:SetBinaryState> </s:Body></s:Envelope>

Headers Tab:
Add the following two

Name: Content-Type
Value: text/xml; charset="utf-8"

Name: SOAPACTION
Value: "urn:Belkin:service:basicevent:1#SetBinaryState"

The above XML turns on the switch. A second consecutive call will fail with an error as it is already switched on, Change the <BinaryState>1</BinaryState> to a 0 if you want to switch it off.

Sandro M

unread,
Jan 17, 2017, 3:49:49 AM1/17/17
to Tasker
Thanks for your post.
Just one note for those lazy guys like me. If you try to copy and paste from this website using the phone browser, the " character gets converted to something else that is not correct due to some font style/formatting.

Here are some screenshots for how it should look like.


Pent

unread,
Jan 17, 2017, 4:09:07 AM1/17/17
to Tasker

You won't be able to specify this bit unfortunately:


-H SOAPACTION: "urn:Belkin:service:basicevent:1#GetBinaryState

I believe there are one or more plugins that let you specify arbitrary request
headers.

Pent
Reply all
Reply to author
Forward
0 new messages