Need help with Web Request

Hi,

I know there is an app to control a Sony Bravia tv, but for me some features are unavailable. Now I know that the Sony Bravia listens to web request. For instance, if I want a virtual button to start a web request that tells the tv to start the Ziggo Go Android TV app I make the web request below:

Method: Post
URL: http://192.168.68.60/DIAL/apps/com.sony.dtv.com.ziggo.tv.com.lgi.horizongo.core.activity.splash.SplashActivity
Header(s): X-Auth-PSK: 1111
Body remains empty

This works.

Now I want to turn on the tv with a web request. In the Android app on my tablet called “HTTP Shortcuts” I made the request for testing and I can confirm that the request works through that app.
Now if I fill in the exact same data in the logic Web request, nothing happens. Below you will find the data used for this action in the app “HTTP Shortcuts”:

Method: Post
URL: http://192.168.68.60/sony/ircc
Headers:
SOAPACTION: “urn:schemas-sony-com:service:IRCC:1#X_SendIRCC”
X-Auth-PSK: 1111

Body:

<?xml version=\"1.0\" encoding=\"utf-8\"?> AAAAAQAAAAEAAAAVAw==

This web request has 2 headers instead of one. I made this request from the desktop app and I used Shift-Enter for creating the second header.

After I send it I grabbed the data and below you see how the request looks like. Can someone tell me what I’m doing wrong?

{“flow”:{“trigger”:{“uri”:“homey:manager:cron”,“id”:“time_exactly”,“args”:{“time”:“19:03”}},“conditions”:,“actions”:[{“group”:“then”,“uri”:“homey:manager:logic”,“id”:“http”,“args”:{“method”:“post”,“url”:“http://192.168.68.60/sony/ircc",“headers”:"SOAPACTION: “urn:schemas-sony-com:service:IRCC:1#X_SendIRCC”\n X-Auth-PSK: 1111”,“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:X_SendIRCC xmlns:u=“urn:schemas-sony-com:service:IRCC:1”> AAAAAQAAAAEAAAAVAw== </u:X_SendIRCC> </s:Body> </s:Envelope>"}}]},“tokens”:{},“sessionId”:“1c3bf9df-776b-4c1c-9a85-b3b62d87840c”}

Difficult to say (tip: use the </> button to format text like that so the editor doesn’t mangle it), but it looks like there’s a space after the \n in the headers (before “X-Auth”).

Also, because of the formatting it’s not clear if you’re using regular quote characters (") or “smart” quote characters () in the SOAPACTION header; they need to be regular.

Hi Robert,

I also tried a logic web request from my desktop, because I need to use multiple headers. One header has double quotes. When I use the double quotes and I hit left shift+enter the cursor jumps to the next line like it is supposed to, but when I start to type on the new line, the cursor jumps back to the end of the previous line and types my new header there. If I dont use the double quotes in my header, the shift+enter works properly. Unfortunatly the double quotes are necessarily for the request to work. This happens in Chrome and in Internet Explorer.

Below the headers I try to input:

SOAPACTION: “urn:schemas- sony-com:service:IRCC:1#X_SendIRCC”
X-Auth-PSK: 1111

I also tried a http request Post xml. But as soon as I use the double quotes in the header I get an “cannot read property “indexof” of null” error. If I dont use the quotes the request gets send, but an 500 error logically returns, because I need to use those quotes.

If you, Robert, or anyone else has a hint, tip or the complete solutions, please let me know.

Regards,

Dennis

Perhaps it works by creating a text file that contains the two headers (on two separate lines) and cutting and pasting them into the flow editor?

Hi Robert,

Thanx! I will try that tomorrow! Keep you posted.

So ended up using the http request app again using the Post XML card.

I finally got it to work, with the help of you and by reading some more and more and more and learning some more.

Seems that the quotes surrounding the Soapaction value need to be taken literally and need to be escaped. This means that the value needs to be formulated differently. Also a small alteration to the body of the xml payload. I left xml version and encoding behind. Below the result url and xml:

{"method":"POST","protocol":"http:","host":"192.168.68.60","path":"/sony/ircc","headers":{"SOAPACTION":"\"urn:schemas-sony-com:service:IRCC:1#X_SendIRCC\"","X-Auth-PSK":"1111"}}

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <s:Body> <u:X_SendIRCC xmlns:u="urn:schemas-sony-com:service:IRCC:1"> <IRCCCode>AAAAAQAAAAEAAAATAw==</IRCCCode> </u:X_SendIRCC> </s:Body> </s:Envelope>

Again thank you for your help!

For anyone else who was struggling with this, I hope this helps and on the link below you will find more official ircc codes. There are more, but these are confirmed:

https://pro-bravia.sony.net/develop/integrate/ircc-ip/ircc-codes/

Regards,

Dennis