UPLOADING CCD XML FILE

Jan 4, 2013 at 5:48 AM

HI Rob,

 

           Do we need upload ccd xml as text file ?

           Is there any things we need follow upload that xml file using putThingText in sdk.

           I am getting some errors when i upload as a text file.

 

 

Coordinator
Jan 4, 2013 at 5:36 PM

CCD is a native Thing type with it's own type-id:  9c48a2b8-952c-4f5a-935d-f3292326bf54

There is a working example checked into the trunk under sdk/src/test/java/com/microsoft/hsg/PutThingsTest.java

        InputStream in = getClass().getResourceAsStream("/TestCCD.txt");
        String rawCCD = streamToString(in);
    	
        StringBuilder infoBuilder = new StringBuilder(256);
        infoBuilder.append("<info><thing>");
        infoBuilder.append("<type-id>9c48a2b8-952c-4f5a-935d-f3292326bf54</type-id>");
        infoBuilder.append("<data-xml>");
        infoBuilder.append(rawCCD);
        infoBuilder.append("</data-xml></thing></info>");
        
        Request request = new Request();
    	request.setMethodName("PutThings");
        request.setInfo(infoBuilder.toString());
        
        SimpleRequestTemplate template = new SimpleRequestTemplate(
            ConnectionFactory.getConnection(),
            "75ac2c6c-c90e-4f7e-b74d-bb7e81787beb",
            "8c390004-3d41-4f5c-8f24-4841651579d6"
        );
        template.makeRequest(request);