try{
String soap_action = "urn:schemas-upnp-org:control-1-0#QueryStateVariable";
String request =
"<?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>";
request += "<u:QueryStateVariable xmlns:u=\"urn:schemas-upnp-org:control-1-0\">" +
"<u:varName>" + name + "</u:varName>" +
"</u:QueryStateVariable>";
request += "</s:Body>"+
"</s:Envelope>";
SimpleXMLParserDocument resp_doc = ((UPnPDeviceImpl)service.getDevice()).getUPnP().performSOAPRequest( service, soap_action, request );
SimpleXMLParserDocumentNode body = resp_doc.getChild( "Body" );
SimpleXMLParserDocumentNode fault = body.getChild( "Fault" );
if ( fault != null ){
throw( new UPnPException( "Invoke fails - fault reported: " + fault.getValue()));
}
SimpleXMLParserDocumentNode resp_node = body.getChild( "QueryStateVariableResponse" );
if ( resp_node == null ){
throw( new UPnPException( "Invoke fails - response missing: " + body.getValue()));
}
SimpleXMLParserDocumentNode value_node = resp_node.getChild( "return" );
return( value_node.getValue());
}catch( Throwable e ){
if ( e instanceof UPnPException ){
throw((UPnPException)e);
}
throw( new UPnPException( "Invoke fails", e ));
}