Skip to main content



      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 07:15 Go to next message
Eclipse UserFriend
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 13:02] by Moderator

Re: (XML or JSON) Serialization of the request and response primitives [message #1730977 is a reply to message #1730976] Sun, 01 May 2016 07:58 Go to previous messageGo to next message
Eclipse UserFriend
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 13:11 Go to previous messageGo to next message
Eclipse UserFriend
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 06:18] by Moderator

Re: (XML or JSON) Serialization of the request and response primitives [message #1731860 is a reply to message #1731074] Tue, 10 May 2016 10:24 Go to previous messageGo to next message
Eclipse UserFriend
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 11:54 Go to previous messageGo to next message
Eclipse UserFriend
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 12:09] by Moderator

Re: (XML or JSON) Serialization of the request and response primitives [message #1731890 is a reply to message #1731882] Tue, 10 May 2016 12:42 Go to previous messageGo to next message
Eclipse UserFriend
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 12:43] by Moderator

Re: (XML or JSON) Serialization of the request and response primitives [message #1731892 is a reply to message #1731890] Tue, 10 May 2016 12:49 Go to previous messageGo to next message
Eclipse UserFriend
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 12:54] by Moderator

Re: (XML or JSON) Serialization of the request and response primitives [message #1751317 is a reply to message #1731892] Sun, 08 January 2017 06:45 Go to previous messageGo to next message
Eclipse UserFriend
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 00:27 Go to previous messageGo to next message
Eclipse UserFriend
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 05:24 Go to previous message
Eclipse UserFriend
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: Wed May 07 21:07:19 EDT 2025

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

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

Back to the top