Jump to content

Help with web services


swnewman

Recommended Posts

Posted

In my quest to get the iRule app on my tablet subscribed to ISY messages, I've had to try to figure out ISY web services.  Without much familiarity with SOAP or WSDL, I was able to do the following from a desktop browser:  Using the Postman extension in Chrome, I posted the example SOAP subscription xml to ISY /services.  Attached shows the screenshot results of that.

 

Essentially I get a Status 200 OK and some response xml.  Assuming that means I have successfully subscribed to ISY, how would I go about viewing messages that should be now flowing to my desktop machine every time ISY records an action?  I would like to see the format of the responses to, say, a light switch turning on.  I assume it is xml; does it follow the same format as the REST responses?  I need to know in order to be able to parse the feedback in iRule.

 

On the other hand if anyone has already gotten subscription to work in iRule, I would welcome any pointers.  So far I have not been successful.  Doesn't seem like I am getting the gateway and/or command set up correctly.

 

Thanks for your help.

 

-Seth

post-3813-0-46866700-1412898259_thumb.png

Posted (edited)

iRule has an ISY module which I'm sure is set up to work with the web services, but it is fairly limited on how you can design with it.  (Trust me I would purchase the module if it would work with my design, it would be so much simpler.)  I am trying to do it with the built in http gateway capability.  Everybody keeps saying it should be possible, but I have yet to run into anybody that has actually done it.

Edited by swnewman
  • 3 weeks later...
Posted (edited)

Michel,

 

I still haven't had much success with this.  I've tried browser-based plugins on my desktop to try to help me understand the web service subscription outside of the iRule application.  As shown in my first post, I can send a subscribe command and get back a "Status 200 OK", along with some xml containing some sort of ID.  This is where I hit a road block.  Once I am "subscribed" successfully, in theory I should be able to receive event-driven responses (i.e. a switch turning on or off), right?  I get no other notices to my desktop when devices are updated in ISY via a switch.  Is this even possible in the browser-based approach I am using?  Or could you suggest another tool more appropriate to the task?  I tried one tool recommended in the wiki but I wasn't even able to get the "Status 200 OK" response to my subscribe POST message.

 

Perhaps I am missing some key piece of knowledge to get this working.  Maybe the socket?  I am simple following the tutorial for the subscribe command and entering "REUSE_SOCKET" for the report url.  Please let me know if that's not right.

 

Sorry for all the questions, I hope you can help me get this working.  I've asked for help on the iRule forums but nobody is able/willing to help me.  I'm sure it's something simple I'm missing, unless they do not provide the ability for the end user to subscribe to ISY feedback outside of their separate ISY module.  That's why I kinda want to get this working outside of their app just to better understand the process.

 

Thanks for the help.

 

-Seth

Edited by swnewman
Posted

Hi Seth,

 

Please send an email to support@universal-devices.com and I'll hook you up with iRule's dev team as I know they have already done all of this.

 

Do you keep the subscription socket open after you make a call or is it closed? You can check the error log for -5011 or -5012 errors. These basically let you know if ISY thinks the socket is closed.

 

With kind regards,

Michel

Posted (edited)

Okay, another iRule user tackled this and managed to get it working using a TCP gateway in iRule versus HTTP.  I've followed his instructions and it looks like I'm getting a good connection to ISY for sending the subscribe command, but I don't appear to be getting any feedback.  I just checked the error log after multiple times pressing the button to send the subscribe command and I see errors like the following:

 

-170001 [uDSockets] RSub:32 error:6

-5012 30

-170001 [uDSockets] RSub:33 error:6

-170001 [uDSockets] RSub:33 error:6

-5012 31

-170001 [uDSockets] RSub:33 error:6

-170001 [uDSockets] RSub:33 error:6

-170001 [uDSockets] RSub:33 error:6

-170001 [uDSockets] RSub:33 error:6

 

Does ISY think the socket is closed?

 

I did notice my rest/subscriptions now has two unexpired subscriptions amongst the expired ones.

<Sub isExpired="no" isPortal="no" sid="33" sock="33" isReusingSocket="yes" isConnecting="no"/>
<Sub isExpired="no" isPortal="no" sid="35" sock="30" isReusingSocket="yes" isConnecting="no"/>

 

On a related note, I decided to clear my error logs and since then every time I press Error Log in the Tools menu it says Request Failed!  Is this a bug?  I've tried creating more subscribe errors but now it seems I can no longer get the error log to download.

Edited by swnewman
Posted

Hi snewman,

 

As I suspected, -5012 errors:

http://wiki.universal-devices.com/index.php?title=ISY-99i/ISY-26_INSTEON:Errors_And_Error_Messages

 

This basically means that ISY tried to publish the events to the client but the client was not there anymore (or didn't respond).

 

Are you immediately going to listen mode after your subscribe?

 

If the log is empty, you get that error.

 

With kind regards,

Michel

Posted

Is there a separate command for "listen mode"?  All I do is send the subscribe command and wait for a response on the screen in a feedback textbox.  I saw no response to the subscribe command or subsequent ISY update events.  The feedback textbox is set to listen for any response (i.e. no parsing).

 

The other user who got this working has shared his setup in the iRule library.  I'm going to import his version, when I get the time, to see if I missed anything in the setup.

Posted

Actually, I got it working finally!  I had a problem with how I was parsing the feedback, but now I see all of the messages coming across.  I think I still get errors in the log, but I'm getting feedback anyway.

 

Quick question:  For updating the state of my devices, I'm guessing I should use the events listed as "ST".  Is that correct?

  • 3 weeks later...
Posted

swnewman,

 

Can you please share how you were able to get subscriptions to work with iRule? Right now I have to query every few seconds and parse the response which is slow. I would love to get the subscription working but don't know where to even begin.

 

Thanks

 

Chris

  • 1 year later...
Guest
This topic is now closed to further replies.

  • Recently Browsing

    • No registered users viewing this page.
  • Who's Online (See full list)

  • Forum Statistics

    • Total Topics
      37k
    • Total Posts
      371.5k
×
×
  • Create New...