|
|
|
|
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 |
Klemen Petrovcic 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 #1731892 is a reply to message #1731890] |
Tue, 10 May 2016 16:49 |
Klemen Petrovcic Messages: 34 Registered: November 2015 |
Member |
|
|
Mahdi Ben Alaya wrote on Tue, 10 May 2016 16:42Dear 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
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04582 seconds