[Fiware-lab-help] Problem with connection using NGSI API

Artur Löwen aloewen at gridhound.de
Fri Nov 20 16:25:12 CET 2015


Hi,

I haven't used my mashup application in the last few weeks, but now my 
NGSI query operator stopped working. After some digging and debugging, 
it seems like the NGSI connection is passing the url of my context 
broker through this url "https://mashup.lab.fiware.org/proxy/<cb_url>" 
and here seems to be the problem. The context broker itself is working 
fine when used from other applications.

The same problem seems to occur, when using the NGSI browser widget from 
the marketplace.

What do I have to do to fix this?

My source looks like this:

         this.ngsi_server = MashupPlatform.prefs.get('ngsi_server');
         this.ngsi_proxy = MashupPlatform.prefs.get('ngsi_proxy');

         var request_headers = {};

         if (MashupPlatform.prefs.get('use_owner_credentials')) {
             request_headers['X-FI-WARE-OAuth-Token'] = 'true';
             request_headers['X-FI-WARE-OAuth-Header-Name'] = 
'X-Auth-Token';
             request_headers['x-FI-WARE-OAuth-Source'] = 
'workspaceowner';
         }

         this.connection = new NGSI.Connection(this.ngsi_server, {
             use_user_fiware_token: 
MashupPlatform.prefs.get('use_user_fiware_token'),
             request_headers: request_headers,
             ngsi_proxy_url: this.ngsi_proxy
         });

         var types = MashupPlatform.prefs.get('ngsi_entities').split(new 
RegExp(',\\s*'));

         var entityIdList = [];
         var attributeList = [];
         var entityId;
         for (var i = 0; i < types.length; i++) {
             entityId = {
                 id: '.*',
                 type: types[i],
                 isPattern: true
             };
             entityIdList.push(entityId);
         }

         var options = {
             flat: true,
             limit: 1000,
             offset: 0,
             details: true,
             onSuccess: function (data, details) {

                 for (var entityId in data) {
                     MashupPlatform.wiring.pushEvent("entityOutput", 
JSON.stringify(data[entityId]));
                 }
                 if (details.count > options.offset + options.limit)
                 {
                 	options.offset += options.limit;
                 	this.connection.query(entityIdList, attributeList, 
options);
                 }
             }.bind(this),
             onFailure: function (e) {
             	MashupPlatform.operator.log("Error querying entities from 
context broker server: " + e.message);
             }
         };
         this.connection.query(entityIdList, attributeList, options);

-- 
Artur Löwen
CEO
Gridhound UG (haftungsbeschränkt)
+49 179 1449189
aloewen at gridhound.de
www.gridhound.de



More information about the Fiware-lab-help mailing list

You can get more information about our cookies and privacy policies clicking on the following links: Privacy policy   Cookies policy