Difference of hubaction command to hubsoapaction command - for parsing the result

I am trying to write a device handler for Netgear Routers. It will enable various actions (such as turning on/off guest wifi) to be handled through ST.
I have the access to device’s SOAP interface through LAN and I know what to send to the device as in SOAP XML format.

I prefer to use HubSoapAction command because it handles the Soap headers. But I could not find any method to add a soap-envelope header section to the soap xml data with HubSoapAction command.
Since some of the commands require this header section, I used HubAction command with raw data instead (idea by @Philippe_Portes )

The problem is , return from the HubAction command does not reach the parse function. It doesn’t trigger parse. Maybe it is not associated with the device I created for my router.

On the other hand , all of the HubSoapAction command responsed trigger the parse function.

My router is using IP and the Soap interface is on tcp port 80
So I entered network device ID c0a8fe01:0050 in my device settings when I created it.
This is correct , right ?

This is the HubAction command I try :slight_smile:

private gwget() {
state.lastcmd = "gwget"
def host = ""
def port = "80"
def hubaction 
try {
hubaction = new physicalgraph.device.HubAction("""POST /soap/server_sa/ HTTP/1.1
SOAPAction: "urn:NETGEAR-ROUTER:service:WLANConfiguration:1#GetGuestAccessEnabled"
Content-Type: text/xml; charset="utf-8"
Host: ${host}:${port}
Accept: */*
User-Agent: Linux UPnP/1.0 SmartThings
Content-Length: 598

<?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/">
<u:GetGuestAccessEnabled xmlns:u="urn:NETGEAR-ROUTER:service:WLANConfiguration:1"></u:GetGuestAccessEnabled>
</s:Envelope>""", physicalgraph.device.Protocol.LAN,"${deviceNetworkId}")
    catch (Exception e) {
        log.debug e
    return hubaction

I can see that the soap packet is reaching my router and it replies (I got network trace on my router)
This is the request and response I see on the trace:

POST /soap/server_sa/ HTTP/1.0
SOAPAction: "urn:NETGEAR-ROUTER:service:WLANConfiguration:1#GetGuestAccessEnabled"
content-type: text/xml;charset=utf-8
User-Agent: SOAP Toolkit 3.0
connection: keep-Alive
Cache-Control: no-cache
Pragma: no-cache
content-length: 599

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<SOAP-ENV:Envelope xmlns:SOAPSDK1="http://www.w3.org/2001/XMLSchema" xmlns:SOAPSDK2="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAPSDK3="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<M1:GetGuestAccessEnabled xmlns:M1="urn:NETGEAR-ROUTER:service:WLANConfiguration:1"></M1:GetGuestAccessEnabled>
</SOAP-ENV:Body></SOAP-ENV:Envelope>HTTP/1.0 200 OK
CONTENT-TYPE: text/xml; charset="utf-8"
SERVER: Linux UPnP/1.0

<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAPSDK1="http://www.w3.org/2001/XMLSchema" xmlns:SOAPSDK2="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAPSDK3="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <m:GetGuestAccessEnabledResponse xmlns:m="urn:NETGEAR-ROUTER:service:WLANConfiguration:1">

On the other hand, this is a sample from HubSoapAction request and response which successfully triggers the parse function:

POST /soap/server_sa/ HTTP/1.1
Accept: */*
User-Agent: Linux UPnP/1.0 SmartThings
CONNECTION: keep-alive
SOAPAction: "urn:NETGEAR-ROUTER:service:DeviceConfig:1#ConfigurationStarted"
Content-Type: text/xml; charset="utf-8"
Content-Length: 343

<?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:ConfigurationStarted xmlns:u="urn:NETGEAR-ROUTER:service:DeviceConfig:1"><NewSessionID>58DEE6006A88A967E89A</NewSessionID></u:ConfigurationStarted></s:Body></s:Envelope>HTTP/1.0 200 OK
CONTENT-TYPE: text/xml; charset="utf-8"
SERVER: Linux UPnP/1.0

<?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/">
    <m:ConfigurationStartedResponse xmlns:m="urn:NETGEAR-ROUTER:service:DeviceConfig:1"></m:ConfigurationStartedResponse>

I really can’t find what is wrong. Please someone who knows the internals of ST hubaction and hubsoapaction commands, help me…

I had different problems before I came to this point. And most of them were solved on the following thread (thanks to @Philippe_Portes ):


I really need help. everything is ready , I just need to parse the response.

I don’T understand the format " physicalgraph.device.Protocol.LAN, “${deviceNetworkId}”)"

what is this deviceNetworkId used for ?
when I write it to log it is null.
if I use instead device.deviceNetworkId ,it has the device ID.
which one should I use ?

nobody to help ?