mTANGO Rest API

Hi,

I am exploring mTANGO Rest API. I've downloaded the mtango.server-rc3-0.1.zip file.

I'm able to send GET and PUT requests (as per the specifications provided in this link) via the curl utility.

My aim is to develop User Interface using AngularJS. I tried using the jsTangORB-rc1-0.1.js file from the jsTangORB-rc1-0.1-bundle.zip file. But unfortunately, it is not compatible with the latest tango.war file.

Any related inputs will be much helpful.

Vatsal
Edited 7 years ago
Hi Vatsal,

Thanks for giving a try to mTangoUI.

mTangoUI is indeed outdated nowdays. You have to use mtangorest.server-rc1 (aka implementation of REST API specification version rc1) with it currently.

I plan to update mTangoUI (including jsTangORB) to be compatible with rc4 (latest version of REST API specification). Hopefully this will be done before the next Tango meeting i.e. begin of June.
Hi Igor,

Thanks for the prompt response. I'll test mTangoUI with the mtangorest-server-rc1 and will get in touch with you in the case of any additional issues.

Vatsal
Hi Igor,

I deployed the mtango.war file from the mtango.server-rc1-0.1.zip as per your suggestion. I'm able to get a list of devices by doing a simple GET request via the browser. Attached is the snapshot for the reference.

I tried using the jsTangORB-rc1-0.1.js file from the jsTangORB-rc1-0.1-bundle.zip, but still I'm not able to invoke jsTangoORB APIs from the .html page. I used the HelloWorld.html file from the jsTangORB-rc1-0.1-bundle.zip.

Appropriate permissions for "mtango-js" user is added in Tango Access Control as well as Tomcat. Snapshots for the same are also attached for the reference.

The mTangoUI is not extracted in the webapps folder.

Your help is needed in resolving this.

Vatsal
Hi Vatsal,

I will have a look!
So here are some comments:

Entry point for mTangoUI is: http://localhost:8080/mtango/js NOT http://localhost:8080/mtango/rest/rc1

So in your JS use the following:


        var TangoTest = new DeviceProxy({url:'http://localhost:8080/mtango/js',device:'sys/tg_test/1'});//NOTE the url parameter
        TangoTest.executeCommand("DevString",{
            argin:"Hello World!!!"
        },{
            onSuccess:function(response){
                alert("Success!!! " + response.argout);
            },
            onFailure:function(response){
                alert("Failure :((( \n" + response.errors.join('\n'));
            }
        });

jsTangORB must be deployed on the same tomcat instance, otherwise you have to setup CORS filter

Applying these changes should help. Let me know your progress.
Edited 7 years ago
Hi Igor,

Your inputs helped in resolving the issue. I've been playing with jsTangORB since a couple of weeks. I encountered some problems on the way. Attached is the TestApp to demonstrate the problems. Google drive link to the mtango.war file that is being used is also attached.

The problem is I'm unable to invoke commands that take any of DevVarCharArray, DevVarDoubleStringArray, DevVarLongStringArray, DevVarULong64Array, DevVarULongArray, DevVarUShortArray as an input argument.

Also, I'm able to invoke commands that take DevDouble as input argument from Mozilla Firefox, but not from Google Chrome. Try opening the TestApp from Mozilla Firefox and Google Chrome. This is quite strange. I didn't understand the reason behind it.

A folder is created for an application in the webapps folder of Tomcat. In application folder, jsTangORB-rc1-0.1.js file and jmvc folder containing include.js file is kept. I think, jsTangoORB can be used without mTangoUI. So there is no need to add anyother files apart from application files in the folder. Please correct me if I' wrong.

I also wanted to check whether jsTangORB is updated to be compatible with rc4 (latest version of REST API specification). jsTangORB file compatible with REST API specification version rc1 does not support various features such as Pipes, Enumerated Attributes, Connectivity with devices from multiple TANGO Facility and so on.

If you find ways for solving the issues, please let me know.

Vatsal
Hi Vatsal,

Thank you very much for your feedback. It is cool that someone from the outside HZG has tested the things.

Vatsal
DevVarCharArray, DevVarDoubleStringArray, DevVarLongStringArray, DevVarULong64Array, DevVarULongArray, DevVarUShortArray as an input argument.

We never used that, so I have not implemented it.

Vatsal
I think, jsTangoORB can be used without mTangoUI. So there is no need to add anyother files apart from application files in the folder.

Yes, you are right the idea behind jsTangORB is to use it without mTangoUI as a pure js library, but jmvc is not related to mTangoUI - it is a standalone JS framework for rich applications: https://en.wikipedia.org/wiki/JavaScriptMVC

I use my own fork of the framework: https://bitbucket.org/Ingvord/javascriptmvc-1.5.x

jmvc/include.js in this case is used to provide integration interface for other jmvc based applications (mTangoUI)


Vatsal
I also wanted to check whether jsTangORB is updated to be compatible with rc4 (latest version of REST API specification). jsTangORB file compatible with REST API specification version rc1 does not support various features such as Pipes, Enumerated Attributes, Connectivity with devices from multiple TANGO Facility and so on.

I have plans to update these libraries (jsTangORB, mTangoUI) to be compatible with rc5 (the next major update for Tango REST API). Not sure when I will be able to do it though…

Vatsal
If you find ways for solving the issues, please let me know.

I have already :) One must seat and do the job ;)

Regards,

Hi Igor,

Thanks for the detailed response.

Could you please include the support for commands with DevVarCharArray, DevVarDoubleStringArray, DevVarLongStringArray, DevVarULong64Array, DevVarULongArray, DevVarUShortArray as an input argument in the next release?

Detailed information about the jsTangORB and jmvc framework is quite useful.

Were you able to reproduce the issue related to Commands with DevDouble as an input argument that I described in the previous post? The output is different across Google Chrome and Mozilla Firefox Web browser. The same behavior can be observed by opening the mTangoTest application from Google Chrome and Mozilla Firefox. Try executing DevDouble command from the mTangoTest application.

If any additional inputs are needed, please let me know.

Vatsal
Hi Igor,

I'm unable to write attributes using the mTango.war file and jsTangORB file that is attached in the previous post.

I'm attempting to write ampli attribute on TangoTest device. Below is the javascript code.

<script>
            var ampliValue = 100.25;
            var TangoTest = new DeviceProxy({url:'http://localhost:8080/mtango/js',device:'sys/tg_test/1'});
            TangoTest.writeAttribute("ampli", {
                    argin:ampliValue
                }, {
                    onSuccess:function(response) {
                        console.debug("Response — " + JSON.stringify(response));
                    },
                    onFailure:function(response) {
                        console.debug("Response — " + JSON.stringify(response));
                    }
            });
</script>

The request is successful, but the value does not get updated at the Device side.

I also checked in the mTangoTest application. Same issue. This is kind of show stopper for us.

Please let me know if it has got something to do with the war file or jsTangoORB file.

Vatsal
Edited 7 years ago
 
Register or login to create to post a reply.