Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » OM2M » (XML or JSON) Serialization of the request and response primitives in MQTT protocol
(XML or JSON) Serialization of the request and response primitives in MQTT protocol [message #1730976] Sun, 01 May 2016 11:15 Go to next message
Klemen Petrovcic is currently offline Klemen PetrovcicFriend
Messages: 34
Registered: November 2015
Member
I was wondering if the 1.0.0 platform version already provides a way to serialize the request and response primitives to XML or JSON?

The reason I'm asking is, because the OneM2M specification for the MQTT protocol requires that the mqtt message payloads should contain the serialized primitives in the mentioned formats.

Thanks in advance.

[Updated on: Tue, 10 May 2016 17:02]

Report message to a moderator

Re: (XML or JSON) Serialization of the request and response primitives [message #1730977 is a reply to message #1730976] Sun, 01 May 2016 11:58 Go to previous messageGo to next message
Thierry Monteil is currently offline Thierry MonteilFriend
Messages: 33
Registered: November 2013
Location: Toulouse - France
Member
hi,
The JSON support is on the dev branch in the eclipse git of OM2M. We will merge with the master branch soon.

Thierry.
Re: (XML or JSON) Serialization of the request and response primitives [message #1731074 is a reply to message #1730977] Mon, 02 May 2016 17:11 Go to previous messageGo to next message
Klemen Petrovcic is currently offline Klemen PetrovcicFriend
Messages: 34
Registered: November 2015
Member
Thanks for answering.

What about the support for XML? I've found that using the following method, the primitive messages can be serialized (though the Content part is left out):

DataMapperSelector.getDataMapperList().get(MimeMediaType.XML).objToString(request)


EDIT: I tried using the JSON serialization which also (like XML serialization) produces a representation without the content (short name "pc") part.

[Updated on: Tue, 03 May 2016 10:18]

Report message to a moderator

Re: (XML or JSON) Serialization of the request and response primitives [message #1731860 is a reply to message #1731074] Tue, 10 May 2016 14:24 Go to previous messageGo to next message
Guillaume Garzone is currently offline Guillaume GarzoneFriend
Messages: 54
Registered: April 2015
Member
Hi Klemen,
By default our platform uses XML serialization and soon the JSON one (on DEV as Thierry said).
What do you mean by the content is left out in serialization ? Is the content missing in the XML/JSON representation after the datamapping ?
Guillaume
Re: (XML or JSON) Serialization of the request and response primitives [message #1731882 is a reply to message #1731860] Tue, 10 May 2016 15:54 Go to previous messageGo to next message
Klemen Petrovcic is currently offline Klemen PetrovcicFriend
Messages: 34
Registered: November 2015
Member
Hi,

it is written in the oneM2M specification, for the MQTT protocol, that the oneM2M request primitives should be carried to the destination in a serialized form (xml, json). The "pc" (content) tag should be included, as is depicted in the example (page 21 of the specification).

If I try, for example, to send this request:

<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<m2m:rqp xmlns:m2m=\"http://www.onem2m.org/xml/protocols\">
	<op>1</op>
	<to>~/in-cse</to>
	<fr>admin:admin</fr>
	<ty>2</ty>
	<nm>MY_SENSOR</nm>
	<pc>
		<om2m:ae xmlns:om2m=\"http://www.onem2m.org/xml/protocols\">
			<api>app-sensor</api>
			<lbl>Type/sensor Category/temperature Location/home</lbl>
			<rr>false</rr>
		</om2m:ae>
	</pc>
</m2m:rqp>


The following request primitive is produced (where the content part is missing):
<m2m:rqp xmlns:m2m="http://www.onem2m.org/xml/protocols">
   <op>1</op>
   <to>~/in-cse</to>
   <fr>admin:admin</fr>
   <ty>2</ty>
   <nm>MY_SENSOR</nm>
</m2m:rqp>


I think this is due to the "Transient" jaxb annotation of the content part of the request object.

I made a workaround for this by first serializing the received request, extracting the content part manually and appending it to the built primitive request.

[Updated on: Tue, 10 May 2016 16:09]

Report message to a moderator

Re: (XML or JSON) Serialization of the request and response primitives [message #1731890 is a reply to message #1731882] Tue, 10 May 2016 16:42 Go to previous messageGo to next message
Mahdi Ben Alaya is currently offline Mahdi Ben AlayaFriend
Messages: 229
Registered: November 2013
Senior Member
Dear Klemen,

What you are saying here is true only for MQTT but it is not the case for HTTP and CoAP.

For HTTP only the "pc" attribute shall be mapped into the request body, the "op" attribute shall be mapped into the HTTP verb, and "fr" and "ty" attributes are mapped into dedicated headers.
You can check the oneM2M HTTP binding here: http://www.etsi.org/deliver/etsi_ts/118100_118199/118109/01.01.00_60/ts_118109v010100p.pdf

The same thing applies for CoAP.
You can check the oneM2M CoAP binding spec here: http://www.etsi.org/deliver/etsi_ts/118100_118199/118108/01.01.00_60/ts_118108v010100p.pdf

For MQTT, it is the job of the MQTT binding plugin to do the correct convertion according to the oneM2M MQTT binding specification.
By the way, are you implementing the MQTT binding for OM2M ?

Regards

[Updated on: Tue, 10 May 2016 16:43]

Report message to a moderator

Re: (XML or JSON) Serialization of the request and response primitives [message #1731892 is a reply to message #1731890] Tue, 10 May 2016 16:49 Go to previous messageGo to next message
Klemen Petrovcic is currently offline Klemen PetrovcicFriend
Messages: 34
Registered: November 2015
Member
Mahdi Ben Alaya wrote on Tue, 10 May 2016 16:42
Dear Klemen,

What you are saying here is true only for MQTT but it is not the case for HTTP and CoAP.

For HTTP only the "pc" attribute shall be mapped into the request body, the "op" attribute shall be mapped into the HTTP verb, and "fr" and "ty" attributes are mapped into dedicated headers.
You can check the oneM2M HTTP binding here: http://www.etsi.org/deliver/etsi_ts/118100_118199/118109/01.01.00_60/ts_118109v010100p.pdf

The same thing applies for CoAP.
You can check the oneM2M CoAP binding spec here: http://www.etsi.org/deliver/etsi_ts/118100_118199/118108/01.01.00_60/ts_118108v010100p.pdf

For MQTT, it is the job of the MQTT binding plugin to do the correct convertion according to the oneM2M MQTT binding specification.
By the way, are you implementing the MQTT binding for OM2M ?

Regards


Yes, I understand. The reason I was asking was because of the mqtt protocol. Maybe I should have made that more clearer in the title and the original message of the topic. I apologise.

Yes, I started implementing it. It currently supports the basic operations, except the NOTIFICATIONS.

[Updated on: Tue, 10 May 2016 16:54]

Report message to a moderator

Re: (XML or JSON) Serialization of the request and response primitives [message #1751317 is a reply to message #1731892] Sun, 08 January 2017 11:45 Go to previous messageGo to next message
Ashok Athukuri is currently offline Ashok AthukuriFriend
Messages: 14
Registered: November 2015
Junior Member
Hi Klemen,

I see notifications event are received as xml format only, is JSON is implemented? If so how can I get in JSON format ?

Thanks,
Ashok
Re: (XML or JSON) Serialization of the request and response primitives [message #1751335 is a reply to message #1751317] Mon, 09 January 2017 05:27 Go to previous messageGo to next message
Ashok Athukuri is currently offline Ashok AthukuriFriend
Messages: 14
Registered: November 2015
Junior Member
I got this at https://bugs.eclipse.org/bugs/show_bug.cgi?id=507443

Thanks
Re: (XML or JSON) Serialization of the request and response primitives [message #1751540 is a reply to message #1751335] Wed, 11 January 2017 10:24 Go to previous message
Guillaume Garzone is currently offline Guillaume GarzoneFriend
Messages: 54
Registered: April 2015
Member
Hi,

We updated the bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=507443 with the new constant to configure the media type of the notification.

Guillaume
Previous Topic:MN-CSE Container Capacity
Next Topic:CoAP Authentication in Request Option Bug
Goto Forum:
  


Current Time: Sat Oct 05 15:59:25 GMT 2024

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

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

Back to the top