Software Archive
Read-only legacy content

Web Services Explorer Does Not Show Custom Service in Projects

Nikos_F_
Novice
913 Views

I'm using Intel XDK 3357 version. on Ubuntu 14.04.

My project consumes custom made rest web service. Since last update I'm unable to find my custom made service in Explore Service. Therefore I'm unable to add new binding from application designer.

Custom web services disappeared on all projects

Can someone explain step by step how to integrate custom made service into the service explorer ?

Also, is there any other way to create service method binding, other that using Explorer Service  ?

BR

Nikos

 

0 Kudos
1 Solution
Nikos_F_
Novice
913 Views

Finally it worked !

With a little try and fail approach, the correct structure seems to be:

apiconfig.json

{
  "XoxPop": {
    "name": "XoxPop",
    "description": "XoxPop* API",
    "dashboardUrl": "http://"
  },    "compatibleProjectTypes": [
            "com.intel.xdk.projecttype.jsapp",
            "com.intel.xdk.projecttype.webapp"
        ]
}

Now the service and it's methods are visible in the Explore Service

 

Thank you very much

BR

Nikos

 

View solution in original post

0 Kudos
14 Replies
Rakshith_K_Intel
Employee
913 Views

you should have json files like apiconfig.json and couple others in your project if you had created a custom webservices, look for those.

 

Here is documentation for creating your own service for data-binding:

https://software.intel.com/en-us/xdk/docs/using-web-services#service_createown

https://software.intel.com/en-us/xdk/docs/using-web-services

 

Another easy way to create data-binding for a single URL REST API is to use the "API Explorer Sandbox", found under "Explore Services", you can add the web service API URL for GET method and create data-bindings and use in App.

 

0 Kudos
Nikos_F_
Novice
913 Views

Hi Krishnappa,

Thank you for your answer. It is correct that under normal circumstances this is true. ...But my custom service worked before update.

For example one of my apiconfig.json files has very simple structure:

{
  "XoxPop": {
    "name": "XoxPop",
    "description": "XoxPop* API",
    "dashboardUrl": "http://"
  }
}

As well as my XoxPop.json & XoxPop.js files.

But service remains invisible under Explore Service.

I underscore that services were visible before last update and invisible after the update.

Maybe some other idea ?

 

BR

Nikos

 

 

0 Kudos
Rakshith_K_Intel
Employee
913 Views

I was just informed that it is a bug introduced in the latest version, it will be fixed in next version.

There is a workaround, you have add this to apiconfig.json:

"compatibleProjectTypes": [
      "com.intel.xdk.projecttype.jsapp",
      "com.intel.xdk.projecttype.webapp"
    ]

 

restart xdk

0 Kudos
Nikos_F_
Novice
913 Views

Hi Krishnappa,

Thank you for your answer.

I tried the workaround you proposed, but with the bellow structure of apiconfig.json file I received the following error: Failed to add apis for exploration from user directory /home/xxxxxxxxxx/xxxxxxxx/xdk/services/iodocs: Could not read file because it is larger than 1GB

apiconfig.json
{
  "XoxPop": {
    "name": "XoxPop",
    "description": "XoxPop* API",
    "dashboardUrl": "http://"
  },  "compatibleProjectTypes": [
      "com.intel.xdk.projecttype.jsapp",
      "com.intel.xdk.projecttype.webapp"
    ]
}

Maybe you could propose the proper way to incorporate the compatibleProjectTypes directive ?

 

BR

Nikos

 

0 Kudos
Nikos_F_
Novice
914 Views

Finally it worked !

With a little try and fail approach, the correct structure seems to be:

apiconfig.json

{
  "XoxPop": {
    "name": "XoxPop",
    "description": "XoxPop* API",
    "dashboardUrl": "http://"
  },    "compatibleProjectTypes": [
            "com.intel.xdk.projecttype.jsapp",
            "com.intel.xdk.projecttype.webapp"
        ]
}

Now the service and it's methods are visible in the Explore Service

 

Thank you very much

BR

Nikos

 

0 Kudos
Nikos_F_
Novice
913 Views

The directive compatibleProjectTypes did the job. Now custom service and its methods are present under the Explore Services.

But this is not the end of the story. While I'm testing my services using [Try It] the response body returns "TypeError: Undefined is not a function" error.  The same problem applies to all my custom services. Like on the screenshot bellow:

Screenshot-Intel® XDK.png

While 3rd party services are showing different error, same as screenshot bellow :

Screenshot-Intel® XDK-1.png

Is there any workaround in order to resolve this problem ?

BR

Nikos

0 Kudos
PaulF_IntelCorp
Employee
913 Views

Nikos -- did you get the proper API key from Google before you tried that? It requires an API key to work. To test without an API key, try the "Markit OnDemand" web service, it does not require an API key. Here's an example:

Screen Shot 2016-05-25 at 4.01.26 PM.png

0 Kudos
Nikos_F_
Novice
913 Views

Hello Paul,

Thank you very much for your response. It seems that, as you said, the Google API key was not correct or there is some other issue with keys. On the other hand the service "Markit OnDeman" works well as you described.

But, I still have issue with my custom services. The strange thing is that exactly the same services in projects established in previous Intel XDK build version are working well.

Do you have some idea what can be wrong, where to search ?

BR

Nikos

0 Kudos
Nikos_F_
Novice
913 Views

It seems, at least with projects made with previous version of Intel XDK, that IDE is not able to update the service-methods.js file. So despite the fact that NEW method bindings added from IDE are looking ok the same methods do not run in debugger/emulator. After manually adding functions to service-methods.js file everything looks ok.

BR

Nikos

0 Kudos
Mike_B_7
New Contributor I
913 Views

I copied and pasted apiconfig.json that you said worked, and then changed the appropriate values, but I'm still getting the 1gb error.

Maybe I'm blind, but I also don't see the difference between the one you said worked and the one you said didn't.

Can you help me spot the difference?

0 Kudos
Nikos_F_
Novice
913 Views

I'm sorry to hear that.

What is your Intel XDK version ? What OS are you using ?

Can you post your apiconfig.json file here ?

BR

Nikos

0 Kudos
Angel_S_
Beginner
913 Views

Hello,

I am exactly in the same situation as Mike B

This is my apiconfig.json, and getting the 1Gb error.

I am not able to use our custom API, which is key for the progress of our project.

{ 

"eshelvesAPI": {

    "name": "eshelves API",
    "description": "A great API",
    "dashboardUrl": "",
    "requiredLibraries": []
  }, "compatibleProjectTypes": [
      "com.intel.xdk.projecttype.jsapp",
      "com.intel.xdk.projecttype.webapp"
    ]
}

 

0 Kudos
alessio_g_
Beginner
913 Views

Hi,
I am exactly in the same situation. 

There are new developments on this issue?

Thanks

0 Kudos
Anjali_G_Intel
Employee
913 Views

For anyone having the problem with custom web services not showing up in the list, update the apiconfig.json file to have these field within the service description object. 

    

    {
      "name": "Lower Case API",
      "description": "A great API",
      "dashboardUrl": "http://developer.example.api",
      "auth": "key",
      "requiredLibraries": [
          "http://example.api/example-api.js"
      ],
      "compatibleProjectTypes": [
        "com.intel.xdk.projecttype.jsapp",
        "com.intel.xdk.projecttype.webapp",
        "com.intel.xdk.projecttype.iotapp"
      ],
      "signature": "apiSecret"
    }

The codes posted before my post have the field 'compatibleProjectTypes' at the wrong level in the json. Please compare it with what I have posted here. This will be fixed in the next XDK update. 

0 Kudos
Reply