CoAP between App and in-cse [message #1786310] |
Mon, 30 April 2018 14:54 |
Paulo Araújo Messages: 8 Registered: March 2017 |
Junior Member |
|
|
Using an example that I found here on the forum, I tried to link my Coap Java application with the in-cse server.
My in-cse "config.ini" file is like this:
org.eclipse.equinox.http.jetty.http.port=8080
org.eclipse.om2m.cseBaseAddress=127.0.0.1
org.eclipse.om2m.cseBaseName=in-name
org.eclipse.om2m.cseBaseId=in-cse
org.eclipse.om2m.adminRequestingEntity=admin\:admin
org.eclipse.om2m.cseType=IN
org.eclipse.om2m.coap.port=5682
org.eclipse.om2m.cseBaseProtocol.default=http //tried with both http and coap here
And my app uses the function (complete class already posted by the author here in the forum somewhere):
public static Request returnCreateAEString(String AEname){
String createApplicationBody = "<om2m:ae xmlns:om2m=\"http://www.onem2m.org/xml/protocols\" rn=\""+AEname+"\">" +
"<api>app-sensor</api>" +
"<lbl>Type/sensor Category/temperature Location/home</lbl>" +
"<rr>true</rr>" +
"</om2m:ae>";
Request createApplication = new Request(Code.POST);
createApplication.getOptions()
.setContentFormat(MediaTypeRegistry.APPLICATION_XML)
.setAccept(MediaTypeRegistry.APPLICATION_XML)
.addOption(new Option(256, "admin:admin"))
.addOption(new Option(267, 2));
createApplication.setPayload(String.valueOf(createApplicationBody));
return createApplication;
}
And in my main class:
performOperation(returnCreateAEString(tempName), "coap://127.0.0.1:5682/~/in-cse");
The problem is that i receive the following error on the server side:
Received request in Router: RequestPrimitive [operation=1,
to=coap://localhost:5682/~/in-cse,
from=admin:admin,
resourceType=2,
content=<om2m:ae xmlns:om2m="http://www.onem2m.org/xml/protocols" rn="MY_SENSOR"><api>app-sensor</api><lbl>Type/sensor Category/temperature Location/home</lbl><rr>true</rr></om2m:ae>,
returnContentType=application/xml,
requestContentType=application/xml,
]
[INFO] - org.eclipse.om2m.core.router.Router
Request targeting another CSE, forwarding to Redirector: /in-cse/coap://localhost:5682/~/in-cse
[INFO] - org.eclipse.om2m.core.redirector.Redirector
Unknow CSE, sending request to registrar CSE: in-cse
java.lang.NullPointerException
|
|
|
|
Powered by
FUDForum. Page generated in 0.02881 seconds