Skip to content

Instantly share code, notes, and snippets.

@brendonanderson
Last active August 29, 2015 13:57
Show Gist options
  • Save brendonanderson/9647872 to your computer and use it in GitHub Desktop.
Save brendonanderson/9647872 to your computer and use it in GitHub Desktop.
UPnP Blog - Status request
HTTPBuilder http = new HTTPBuilder("http://192.168.1.120:49153/upnp/control/basicevent1")
http.request(Method.POST, ContentType.XML) {
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:GetBinaryState xmlns:u="urn:Belkin:service:basicevent:1">' +
'<BinaryState>1</BinaryState>' +
'</u:GetBinaryState>' +
'</s:Body>' +
'</s:Envelope>'
headers.'SOAPACTION' = "\"urn:Belkin:service:basicevent:1#GetBinaryState\""
headers.'Content-Type' = "text/xml; charset=\"utf-8\""
headers.'Accept' = ""
response.success = { resp, xml ->
println xml.Body.GetBinaryStateResponse.BinaryState.text()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment