new clone OM2M version (clone on 3.12.2016) not working? [message #1749199] |
Sat, 03 December 2016 00:24 |
Son Duong Messages: 60 Registered: June 2016 |
Member |
|
|
Hello all,
I created an application plugin as followed this tutorial: https://wiki.eclipse.org/OM2M/one/Developer. When run it, I got 5000 Internal error.
What I did was creating an AE called EVALUATE_VALUES and deployed it to the mn-cse node.
And when I see the log files:
[i][INFO] - org.eclipse.om2m.core.router.Router
Received request in Router: RequestPrimitive [operation=1,
from=admin:admin,
resourceType=2,
name=EVALUATE_VALUES,
content=org.eclipse.om2m.commons.resource.AE@4a0468a3,
returnContentType=application/obj,
requestContentType=application/obj,
]
[INFO] - org.eclipse.om2m.core.router.Router
Request handling in the current CSE: null
[INFO] - org.eclipse.om2m.core.router.Router
ResourceController to be used [AEController][/i]
I realized that the log files did not show the to parameter which should be /mn-cse and therefore the Router showed the targetTo parameter in the "Request handling in the current CSE" is null. Therefore the Router didn't know the target address to route the request.
Does anyone have an idea how to fix it?
Thank you so much!
Son
P/s: my createSensorResources() method:
public void createSensorResources(){
String targetId, content;
targetId = "/" + CSE_ID + "/" + CSE_NAME;
//create application entity
AE ae = new AE();
ae.setRequestReachability(true);
ae.setAppID(ipeId);
ae.getPointOfAccess().add(ipeId);
ResponsePrimitive response = RequestSender.createAE(ae, sensorId);
if(response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)){
targetId = "/" + CSE_ID + "/" + CSE_NAME + "/" + sensorId;
Container cnt = new Container();
cnt.setMaxNrOfInstances(BigInteger.valueOf(10));
// Create the DESCRIPTOR container
RequestSender.createContainer(targetId, DESCRIPTOR, cnt);
// Create the DATA container
RequestSender.createContainer(targetId, DATA, cnt);
// Create the description contentInstance
content = ObixUtil.getSensorDescriptorRep(sensorId, ipeId);
targetId = "/" + CSE_ID + "/" + CSE_NAME + "/" + sensorId + "/" + DESCRIPTOR;
ContentInstance cin = new ContentInstance();
cin.setContent(content);
cin.setContentInfo(MimeMediaType.OBIX);
RequestSender.createContentInstance(targetId, cin);
}
}
The createResource() method in the RequestSender class:
public static ResponsePrimitive createResource(String targetId, String name, Resource resource, int resourceType){
RequestPrimitive request = new RequestPrimitive();
request.setFrom(Constants.ADMIN_REQUESTING_ENTITY);
request.setTargetId(targetId);
request.setResourceType(BigInteger.valueOf(resourceType));
request.setRequestContentType(MimeMediaType.OBJ);
request.setReturnContentType(MimeMediaType.OBJ);
request.setContent(resource);
request.setName(name);
request.setOperation(Operation.CREATE);
return CSE.doRequest(request);
}
public static ResponsePrimitive createAE(AE resource, String name){
return createResource("/" + Constants.CSE_ID, name, resource, ResourceType.AE);
}
[Updated on: Sat, 03 December 2016 01:50] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02213 seconds