Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Kura » Sending a PUT request(How to serialize configurations in XML format.)
Sending a PUT request [message #1728479] Mon, 04 April 2016 17:43 Go to next message
Saleh Mohd is currently offline Saleh MohdFriend
Messages: 13
Registered: October 2015
Junior Member
Hi everyone,

I am trying to send a PUT request to my gateway (RP2) running Kura in order to modify configuration properties of a particular application. I have implemented my client application that leverages mqtt to send these requests to the gateway. So far I can send GET requests of the form $EDC/kura/pi2/CONF-V1/GET/configurations and $EDC/kura/pi2/CONF-V1/GET/configurations/<app_pid> with promising results.

Now, I want to send updates to a particular application using PUT method but I have got stuck on how to serialize these configuration properties. According to the documentation I am following [1], the request payload needs to be serialized in xml format. There are lot of classes in [2] that looks like they can do the job, but I can not figure out where to start. So if anyone can refer me to an example where these classes are used to generate such a request, or if there is a better way of doing it without using these classes, I will very grateful.

Thanks,
Saleh

[1] http://eclipse.github.io/kura/ref/mqtt-namespace.html
[2] https://github.com/eclipse/kura/tree/842bbf4ecafe2d32a0e0defcc4ac8f88f9453a02/kura/org.eclipse.kura.core.configuration/src/main/java/org/eclipse/kura/core/configuration
Re: Sending a PUT request [message #1728498 is a reply to message #1728479] Tue, 05 April 2016 03:08 Go to previous messageGo to next message
David Woodard is currently offline David WoodardFriend
Messages: 420
Registered: July 2014
Senior Member
Hi Saleh,

The serialization being referred to is provided by Google Protobuf. The .proto file you will need is here [1]. You can see how Kura serializes/deserializes Google Protobufs here [2][3].

[1] https://github.com/eclipse/kura/blob/develop/kura/org.eclipse.kura.core.cloud/src/main/protobuf/kurapayload.proto
[2] https://github.com/eclipse/kura/blob/develop/kura/org.eclipse.kura.core.cloud/src/main/java/org/eclipse/kura/core/cloud/CloudPayloadProtoBufDecoderImpl.java
[3] https://github.com/eclipse/kura/blob/develop/kura/org.eclipse.kura.core.cloud/src/main/java/org/eclipse/kura/core/cloud/CloudPayloadProtoBufEncoderImpl.java

Thanks,
--Dave
Re: Sending a PUT request [message #1728587 is a reply to message #1728498] Tue, 05 April 2016 15:43 Go to previous messageGo to next message
Saleh Mohd is currently offline Saleh MohdFriend
Messages: 13
Registered: October 2015
Junior Member
Hi David,

Thanks so much. Your clarification saved my day. I am already using those classes you mentioned. So no worries.

Thanks,
Saleh
Re: Sending a PUT request [message #1732238 is a reply to message #1728587] Fri, 13 May 2016 16:49 Go to previous messageGo to next message
Shiao Jon is currently offline Shiao JonFriend
Messages: 13
Registered: May 2016
Junior Member
Can you tell how to receive response when publishes "$EDC/kura/pi2/CONF-V1/GET/configurations" ?
Re: Sending a PUT request [message #1732328 is a reply to message #1732238] Mon, 16 May 2016 02:42 Go to previous message
Shiao Jon is currently offline Shiao JonFriend
Messages: 13
Registered: May 2016
Junior Member
Hi , All
I solved it , thanks a lot.
Previous Topic:Kura Configurable Components
Next Topic:Mqtt subscribe problem
Goto Forum:
  


Current Time: Fri Apr 26 10:08:04 GMT 2024

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

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

Back to the top