Skip to main content



      Home
Home » Eclipse Projects » OM2M » Create AE via MQTT Binding(MQTT Binding)
Create AE via MQTT Binding [message #1764634] Thu, 01 June 2017 01:12 Go to next message
Eclipse UserFriend
Hi.

I already did Create AE via HTTP (REST API) following OM2M HTTP binding Wiki.

There were many examples like create AE , Create DESCRIPTOR container so on..

But I don't know How to send a message via MQTT binding.

Is Anyone know How to do this?

I need a topic and payload that can follow to do this.

Also If you have a example like under method plz tell me.

1. Create a application
2. Create a DESCRIPTOR container
3. Create a description contentInstance
4. Create a DATA container
5. Create a data contentInstance

Is anyone know how to do this reply me.!

Thanks
Re: Create AE via MQTT Binding [message #1764829 is a reply to message #1764634] Fri, 02 June 2017 09:48 Go to previous messageGo to next message
Eclipse UserFriend
Hello,

There is an example on how to create a container in the MQTT Binding tutorial:

https://wiki.eclipse.org/OM2M/one/MQTT_Binding

You can use tools such as MQTTLens to test this.

Cheers!

[Updated on: Fri, 02 June 2017 09:49] by Moderator

Re: Create AE via MQTT Binding [message #1764955 is a reply to message #1764829] Sun, 04 June 2017 19:59 Go to previous messageGo to next message
Eclipse UserFriend
Thank you for your reply.

I tried Create Container via MQTT and it responsed 'there is no parent AE'

So I tried to make Application for and here is my topic and json.

topic : /oneM2M/req/MY-SENSOR/in-cse/json
payload :
{
"m2m:rqp" : {
"fr" : "MY-SENSOR",
"to" : "/in-cse",
"op" : 1,
"rqi": 123456,
"pc": {
"m2m:ae" : {
"rn": "MY-SENSOR",
"rr": "false"

}
},
"ty": 2
}
}

But still not working So Can you give me a example to make AE?

like https://wiki.eclipse.org/OM2M/REST_API page

Create a "MY_SENSOR" application >> This API to MQTT

Re: Create AE via MQTT Binding [message #1765050 is a reply to message #1764955] Tue, 06 June 2017 04:04 Go to previous messageGo to next message
Eclipse UserFriend
Hello,

This works for me:

Topic: /oneM2M/req/MY-SENSOR/in-cse/json

Payload:
{
"m2m:rqp": {
"fr" : "admin:admin",
"to" : "/in-cse/in-name",
"op" : 1,
"rqi": 123456,
"pc": {
"m2m:ae" : {
"api": "app-sensor",
"rr": "false",
"rn": "MY-SENSOR"
}
},
"ty": 2
}
}

I hope it helps.
Cheers!
Re: Create AE via MQTT Binding [message #1776824 is a reply to message #1764829] Wed, 22 November 2017 00:15 Go to previous messageGo to next message
Eclipse UserFriend
Topic: /oneM2M/req/MY-SENSOR/in-cse/json

What is MY-SENSOR ? Can i understand it is Client ID of mqttlen

And, when you publish into Topic: /oneM2M/req/MY-SENSOR/in-cse/json
Have any response ? Could you show me it ?

[Updated on: Wed, 22 November 2017 09:41] by Moderator

Re: Create AE via MQTT Binding [message #1778805 is a reply to message #1764634] Thu, 21 December 2017 11:01 Go to previous messageGo to next message
Eclipse UserFriend
Whenever I throw a correctly formatted JSON object at the MQTT broker, I get the following error in in-cse:

[INFO] - org.eclipse.om2m.core.router.Router
OM2M exception caught in Router: No Operation provided


I followed examples provided here, in "Test MQTT blinding in OM2M" and in the MQTT bindings section. Nothing seems to work.

The part which says "No operation provided", does it refer to "op" field in "m2m:rqp"?
Re: Create AE via MQTT Binding [message #1778840 is a reply to message #1764634] Fri, 22 December 2017 06:35 Go to previous messageGo to next message
Eclipse UserFriend
I started to do some debugging through the MQTT request process. It turns out that an MQTT request is caught by the MqttRequestHelper and send to the method stringToObj in datamapping/jaxb/Mapper for un-marshalling. The string representation seems to be valid, but un-marshalling returns an empty object?
Re: Create AE via MQTT Binding [message #1778841 is a reply to message #1764634] Fri, 22 December 2017 06:36 Go to previous messageGo to next message
Eclipse UserFriend
I started to do some debugging through the MQTT request process. It turns out that an MQTT request is caught by the MqttRequestHelper and send to the method stringToObj in datamapping/jaxb/Mapper for un-marshalling. The string representation seems to be valid, but un-marshalling returns an empty object?
Re: Create AE via MQTT Binding [message #1778843 is a reply to message #1778841] Fri, 22 December 2017 06:41 Go to previous messageGo to next message
Eclipse UserFriend
I found in Router.java the exception: - line 130
code]if(request.getOperation() == null){
throw new BadRequestException("No Operation provided");
}[[/code]
The code seem not to read the "op" filed.
Do you have any idea to fix these problem ?
Re: Create AE via MQTT Binding [message #1778848 is a reply to message #1778843] Fri, 22 December 2017 08:13 Go to previous messageGo to next message
Eclipse UserFriend
hieu tran wrote on Fri, 22 December 2017 11:41
I found in Router.java the exception: - line 130
code]if(request.getOperation() == null){
throw new BadRequestException("No Operation provided");
}[[/code]
The code seem not to read the "op" filed.
Do you have any idea to fix these problem ?


The exception is not the problem. It seems that the request is empty (and therefore the operation is null), which means that the incoming MQTT request is not parsed. I think the un-marshaller is broken.

[Updated on: Fri, 22 December 2017 08:15] by Moderator

Re: Create AE via MQTT Binding [message #1778849 is a reply to message #1778843] Fri, 22 December 2017 08:13 Go to previous messageGo to next message
Eclipse UserFriend
double post

[Updated on: Fri, 22 December 2017 08:14] by Moderator

Re: Create AE via MQTT Binding [message #1778960 is a reply to message #1778849] Tue, 26 December 2017 09:47 Go to previous messageGo to next message
Eclipse UserFriend
Anyone can fix "op" problem?
I have same problem that No operation provided.
Any idea to fix that?
Re: Create AE via MQTT Binding [message #1782331 is a reply to message #1778960] Thu, 22 February 2018 00:31 Go to previous messageGo to next message
Eclipse UserFriend
Hi everyone, I am also getting same response, anybody can help to fix that? dms.stringToObj (payload) returns an empty object.
Re: Create AE via MQTT Binding [message #1783210 is a reply to message #1782331] Fri, 09 March 2018 03:45 Go to previous messageGo to next message
Eclipse UserFriend
Hi, I am facing the same issue. Here is the request I send and the respond I get :

            {
                "m2m:rqp": {
                    "fr": "SENSOR2",
                    "to": "/mn-cse/RSU/SENSOR2/DATA",
		    "op": 1,
                    "rqi": 179,
                    "pc": {
                        "m2m:cin": {
                        "cnf": "dht2",
                        "con": "24.60_25.60"
                        }
                    },
                    "ty": 4
                }
            }
            
{
   "m2m:rsp" : {
      "m2m:rsc" : 4000,
      "m2m:pc" : "No Operation provided",
      "m2m:fr" : "/mn-cse"
   }
}


If someone know how I can fix it, I could use some help.
Re: Create AE via MQTT Binding [message #1783217 is a reply to message #1783210] Fri, 09 March 2018 05:03 Go to previous messageGo to next message
Eclipse UserFriend
send request as below:

{
"m2m:rqp": {
"m2m:fr": "SENSOR2",
"m2m:to": "/mn-cse/RSU/SENSOR2/DATA",
"m2m:op": 1,
"m2m:rqi": 179,
"m2m:pc": {
"m2m:cin": {
"cnf": "dht2",
"con": "24.60_25.60"
}
},
"m2m:ty": 4
}
}


Regards
Kamran
Re: Create AE via MQTT Binding [message #1783223 is a reply to message #1783217] Fri, 09 March 2018 05:59 Go to previous messageGo to next message
Eclipse UserFriend
Ok, first, thank you for your quick answer.
I tried your solution and I now have a different issue :

{
   "m2m:rsp" : {
      "m2m:rsc" : 4004,
      "m2m:rqi" : "4",
      "m2m:pc" : "Cannot find parent resource",
      "m2m:to" : "SENSOR2",
      "m2m:fr" : "/mn-cse"
   }
}

Re: Create AE via MQTT Binding [message #1783230 is a reply to message #1783223] Fri, 09 March 2018 07:35 Go to previous messageGo to next message
Eclipse UserFriend
Have you created AE and Container?


Regards
Kamran
Re: Create AE via MQTT Binding [message #1783236 is a reply to message #1783230] Fri, 09 March 2018 08:10 Go to previous messageGo to next message
Eclipse UserFriend
Are you referring to the 3 JSON shown in the MQTT Binding tutorial ? If so yes, at least I tried. Here are the messages I send and receive :
{
   "m2m:rqp": {
      "m2m:fr": "SENSOR2",
      "m2m:to": "/mn-cse",
      "m2m:op": 2,
      "m2m:rqi": 1111111
   }
}
    

{
    "m2m:rqp" : {
        "m2m:fr" : "SENSOR2",
        "m2m:to" : "/mn-cse/mn-name/SENSOR2",
        "m2m:op" : 1,
        "m2m:rqi": 123456,
        "m2m:pc": {
            "m2m:cnt" : {
                "rn": "DATA"
            }
        },
        "m2m:ty": 3
    }
}

{
   "m2m:rsp" : {
      "m2m:rsc" : 2000,
      "m2m:rqi" : "1111111",
      "m2m:pc" : {
         "m2m:cb" : {
            "rn" : "mn-name",
            "ty" : 5,
            "ri" : "/mn-cse",
            "ct" : "20180308T164949",
            "lt" : "20180308T164949",
            "acpi" : [ "/mn-cse/acp-207203953" ],
            "cst" : 1,
            "csi" : "mn-cse",
            "srt" : [ 1, 2, 3, 4, 5, 9, 14, 15, 16, 17, 23, 28 ],
            "poa" : [ "http://127.0.0.1:8282/" ]
         }
      },
      "m2m:to" : "SENSOR2",
      "m2m:fr" : "/mn-cse"
   }
}
{
   "m2m:rsp" : {
      "m2m:rsc" : 4004,
      "m2m:rqi" : "123456",
      "m2m:pc" : "Resource not found",
      "m2m:to" : "SENSOR2",
      "m2m:fr" : "/mn-cse"
   }
}
            {
                "m2m:rqp": {
                    "m2m:fr": "SENSOR2",
                    "m2m:to": "/mn-cse/mn-name/SENSOR2/DATA",
                    "m2m:op": 1,
                    "m2m:rqi": "0",
                    "m2m:pc": {
                        "m2m:cin": {
                            "cnf": "dht2",
                            "con": "25.30_28.40"
                        }
                    },
                    "m2m:ty": 4
                }
            }
            
{
   "m2m:rsp" : {
      "m2m:rsc" : 4004,
      "m2m:rqi" : "0",
      "m2m:pc" : "Resource not found",
      "m2m:to" : "SENSOR2",
      "m2m:fr" : "/mn-cse"
   }
}

Re: Create AE via MQTT Binding [message #1783239 is a reply to message #1783236] Fri, 09 March 2018 08:40 Go to previous messageGo to next message
Eclipse UserFriend
It seems that AE is not created.

Create AE i.e. "SENSOR2" through request as below:

{
"m2m:rqp": {
"m2m:fr" : "admin:admin",
"m2m:to" : "/in-cse/in-name",
"m2m:op" : 1,
"m2m:rqi": 123456,
"m2m:pc": {
"m2m:ae": {
"api": "123",
"rr": "true",
"rn": "SENSOR2"
}
},
"m2m:ty": 2
}
}


Regards
Kamran
Re: Create AE via MQTT Binding [message #1783242 is a reply to message #1783239] Fri, 09 March 2018 09:11 Go to previous messageGo to next message
Eclipse UserFriend
I added the creation of the AE and now I have this kind of error :
{
   "m2m:rsp" : {
      "m2m:rsc" : 4105,
      "m2m:rqi" : "2222222",
      "m2m:pc" : "Name already present in the parent collection.",
      "m2m:to" : "admin:admin",
      "m2m:fr" : "/mn-cse"
   }
}
{
   "m2m:rsp" : {
      "m2m:rsc" : 4103,
      "m2m:rqi" : "123456",
      "m2m:pc" : "Unknown or unauthorized originator",
      "m2m:to" : "SENSOR2",
      "m2m:fr" : "/mn-cse"
   }
}



The error I have when I try to update the container is the same : "Resource not found "
Re: Create AE via MQTT Binding [message #1783243 is a reply to message #1783223] Fri, 09 March 2018 09:21 Go to previous messageGo to next message
Eclipse UserFriend
Thanks for your helping.
Can you tell me how you know it ?
Did you find in source code or other document ? Can you share with me ?
Re: Create AE via MQTT Binding [message #1783244 is a reply to message #1783243] Fri, 09 March 2018 09:41 Go to previous messageGo to next message
Eclipse UserFriend
There is nothing to do with the source code.
To come to this point I followed those tutorials, bu I assume you have already look at those :
https://www.eclipse.org/forums/index.php/t/1090165/
https://wiki.eclipse.org/OM2M/one/MQTT_Binding
Re: Create AE via MQTT Binding [message #1783324 is a reply to message #1783242] Mon, 12 March 2018 01:30 Go to previous messageGo to next message
Eclipse UserFriend
Can you show me three requests and their corresponding responses?

1. AE creation
2. Container Creation
3. Content instance creation


Regards
Kamran

[Updated on: Mon, 12 March 2018 01:32] by Moderator

Re: Create AE via MQTT Binding [message #1783334 is a reply to message #1783324] Mon, 12 March 2018 03:38 Go to previous messageGo to next message
Eclipse UserFriend
Hi, I am not so sure of what I am doing but to me the requests are the following :

1. AE creation
{
        "m2m:rqp": {
                "m2m:fr" : "admin:admin",
                "m2m:to" : "/mn-cse/mn-name",
                "m2m:op" : 1,
                "m2m:rqi": 2222222,
                "m2m:pc": {
                        "m2m:ae": {
                        "api": "123",
                        "rr": "true",
                        "rn": "SENSOR2"
                        }
                },
                "m2m:ty": 2
                }
}



2.Container Creation
{
    "m2m:rqp" : {
        "m2m:fr" : "SENSOR2",
        "m2m:to" : "/mn-cse/mn-name/SENSOR2",
        "m2m:op" : 1,
        "m2m:rqi": 123456,
        "m2m:pc": {
            "m2m:cnt" : {
                "rn": "DATA"
            }
        },
        "m2m:ty": 3
    }
}


3. Content instance creation
 {
                "m2m:rqp": {
                    "m2m:fr": "SENSOR2",
                    "m2m:to": "/mn-cse/mn-name/SENSOR2/DATA",
                    "m2m:op": 1,
                    "m2m:rqi": "%s",
                    "m2m:pc": {
                        "m2m:cin": {
                            "cnf": "dht2",
                            "con": "%s"
                        }
                    },
                    "m2m:ty": 4
                }
            }

Re: Create AE via MQTT Binding [message #1783335 is a reply to message #1783334] Mon, 12 March 2018 03:48 Go to previous messageGo to next message
Eclipse UserFriend
Modify container and content instance request as follow

"m2m:fr" : "admin:admin"

It seems that AE has been created but Container not created due to unauthorized originator, as "m2m:fr" parameter is not properly defined.

Regards
Kamran
Re: Create AE via MQTT Binding [message #1783337 is a reply to message #1783335] Mon, 12 March 2018 04:28 Go to previous message
Eclipse UserFriend
It is now working fine !
Thank you for the help (:
Previous Topic:Test MQTT blinding in OM2M
Next Topic: Eclipse OM2M v1.3.0
Goto Forum:
  


Current Time: Thu Apr 17 15:27:40 EDT 2025

Powered by FUDForum. Page generated in 0.05470 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top