XML Web request


#1

Hi guys, I am trying to create a piston and send commands from AskAlexa to webCoRE and than to the REST API of my Sony Bravia Android TV.
The problem is that I can’t find a way to send a XML message to the API of the TV (yes, it doesn’t support JSON for sending commands) and I am unable to set custom request headers. It’s my first piston so I am not sure if I am just not aware how to do that or it’s not possible yet.

Here is an example of the message I try to send:

POST /sony/IRCC HTTP/1.1
Host: 192.168.1.212
Content-Type: text/xml; charset="utf-8"
SOAPAction: "urn:schemas-sony-com:service:IRCC:1#X_SendIRCC"
X-Auth-PSK: 0000

<?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”>
AAAAAQAAAAEAAAABAw==
</u:X_SendIRCC>
</s:Body>
</s:Envelope>

Thank you for the help!


#2

Unfortunately it’s not possible using just webCoRE at this time. I will share my normal recommendation for people coming to this thread for help with XML requests, but your case has additional complexity due to the TV living on your local network.

See this thread for a discussion of XML requests and responses.

I have advised a few people so far to use IFTTT for sending requests that cannot be created directly in webCoRE. Here is an example of a request that was not possible in webCoRE and a few comments down the solution using IFTTT.

However, since the TV is on your local network and [hopefully] not publicly accessible IFTTT will not be able to communicate with it. Instead you would need to have a local server that can take some arguments from webCoRE and issue the proper XML request to your TV. This is a great case to justify revisions to the current web request feature, something I plan to work on over the next few months.

You might want to look for a device type handler for communicating with the Sony Bravia TV. There may be something out there that can control the TV without having to use XML requests.


#3

Thanks for the quick reply! I will take a look how I can solve that without adding more complexity.

Looking forward to see webCoRE even more powerful in the future! Great work!