FIWARE-TMForum / Business-API-Ecosystem

The FIWARE/TMForum Business API Ecosystem allows the monetization of different kind of assets (both digital and physical) during the whole service life cycle, from offering creation to its charging, accounting and revenue settlement and sharing
https://business-api-ecosystem.rtfd.io/
GNU Affero General Public License v3.0
39 stars 22 forks source link

Acquire dataset from CKAN + BIZ #45

Closed Urtza2 closed 5 years ago

Urtza2 commented 5 years ago

Hi, I have two users, one with "Seller" role and another one with "Provider" role. Seller user has been created a dataset, publish and offering of the dataset and it works correctly. Provider user use CKAN to acquire dataset for that, he click on "acquire" button that appear on the right side of dataset name. It redirect correctly to Biz Ecosystem Marketplace and he can checkout and pay for it (Free in this case). Until now it seems that everything works well but when he wants to see the acquired dataset he CAN'T. The status in CKAN is the same the dataset contains "acquire" button. You can see in this figure:

I think that in Postgres it should be fill some record in "package_allowed_users" when I put it manually it works.

Please someone can help me with this, Thank you Urtza ckan

fdelavega commented 5 years ago

It seems that the BAE notification is not arriving to CKAN API.

Can you check which is the status of the acquired dataset in products section (Under My Inventory)?

The status should be active, if the status is created means that something failed during activation (access grant) of the offering.

Urtza2 commented 5 years ago

Hi @fdelavega , I have two user:

Donostia has acquired dataset using CKAN.

Logged as donistia (buyer) As you tell me I have checked "Products" section and I have not anything but in "Product orders" section y "Requested" I have this: bzi

Status is completed but when I returns to CKAN the acquire button not dissapear.

Can you help again ;_) Thanks Urtza

I check "Products" section and I

Urtza2 commented 5 years ago

Sorry again, I don't have anything under Products. When I click on "Checkout" button, application callback to My Inventory> Products and it says me "No products found", I don't know whait is happen. I supponse that is the main problem of this issue. I look for logs files and I check in the glassfish logs too. "Server.log" and RSS logs. I put you in this comment

server.log main.log

I don't know what it is happened. I think so that it is the last problem/issue that I have to solve. Please, @fdelavega can you help me with this, I have no more time to working with this. During this week I have to write a document presenting the evaluation of this tool and for me it will be a great pleasure if I present this with any problems and the city councils of different cities that work in REPLICATE 2020 European Project can use this. Thanks. Urtza

ansh1221 commented 5 years ago

Hi @Urtza2 how did you installed and setup the Business API Ecosystem. I have installed it on Fiware Lab and after performing the steps mentioned there it didn't worked. Can you please guide me on it?

Urtza2 commented 5 years ago

Hi ansh1221, I have read the installation instruction from https://business-api-ecosystem.readthedocs.io/en/latest/installation-administration-guide.html But in my case when I arrive to $ ./install.py all step, I have to comment in install.py file the installation corresponding to logic proxy and I do it manually. Anyway I have install it but it didn't work at all.

What is your ptoblem with this?

Urtza

ansh1221 commented 5 years ago

Hi @Urtza2 Sir,

I am able to access the Business-api-ecosystem API and have created an offering by name Arnav on Business API Ecosystem , by clicking on Administration -> New . But while integrating it with CKAN, I am facing following issues.

1) While Publishing it on CKAN, I receive the following errors with logs attached. while the last one is the screenshot of Business ecosystem.


CKAN Internal Server Error

image


CKAN Logs:

image


Business API Ecosytem

image


Two types of error:

1) In The logs you would see that : /charging/api/assetManagement/assets/uploadJob): 504 {"error":"Service unreachable"}

2) And sometimes,

2019-02-21 14:26:11,157 WARNI [ckanext.baepublisher.store_connector] **(missing_token) Missing access token parameter.**
Error - <type 'exceptions.UnboundLocalError'>: local variable 'resource' referenced before assignment
URL: [http://%3cCKAN-IP%3e:5000/dataset/publish/contex2]http://<CKAN-IP>:5000/dataset/publish/contex2
File '/usr/lib/ckan/default/lib/python2.7/site-packages/weberror/errormiddleware.py', line 171 in __call__
 app_iter = self.application(environ, sr_checker)
File '/usr/lib/ckan/default/lib/python2.7/site-packages/webob/dec.py', line 147 in __call__
File '/usr/lib/ckan/default/lib/python2.7/site-packages/pylons/controllers/core.py', line 60 in _perform_call
  return func(**args)
File '/usr/lib/ckan/default/lib/python2.7/site-packages/ckanext_baepublisher-0.5-py2.7.egg/ckanext/baepublisher/controllers/ui_controller.py', line 221 in publish
  dataset, offering_info)
File '/usr/lib/ckan/default/lib/python2.7/site-packages/ckanext_baepublisher-0.5-py2.7.egg/ckanext/baepublisher/store_connector.py', line 485 in create_offering
  self._rollback(offering_info, resource, offering_created)
UnboundLocalError: local variable 'resource' referenced before assignment

For 2nd type of Logs I successfully Logged in through Oauth2 Keyrock IDM.

Note :

I Request you to, if you can run it on fiware lab node as well with already existing image of Business API Ecosystem.

I am using Fiware Lab Node. I had created an instance taking the image of Business-API-Ecosytem(3.3GB) image in it and then launched it. There are some 4-5 steps that needs to be followed like callback url etc in config.js. And then we are good to go to use this GE.

It would be highly grateful, if you can please help me with it? Thanks!

Urtza2 commented 5 years ago

Hi ansh1221, Sorry for this answer but I can't do it, I have not install as Fiware Lab Node, I installed from Git in a dedicated machine for it. I can't help you in any log because my problems with that have been different. I have only help you with something. In CKAN production.ini file, have you put correctly BAE publisher URL in ckan.baepublisher.store_url ? and do you have started BAE publisher when you click on "Publish" in CKAN? It seems that CKAN can't find BAE. Respecting offering, BAE store information in MYSQL database, do you check if "Arnav" offer is in any database ? (DS_PRODUCT_OFFERING)

Best regards, Urtza

fdelavega commented 5 years ago

Hi @ansh1221, BAE version in the FIWARE lab is quite old and I do not recommend you to use that (nor the manual installation). Instead, I would recommend the usage of docker images as is the preferred mechanism:

https://business-api-ecosystem.readthedocs.io/en/latest/docker-guide.html

Regarding your issue it seems that CKAN cannot access the BAE, so probably the BAE url setting is not properly configured

fdelavega commented 5 years ago

Hi @Urtza2 from your error, it seems that the Ordering API cannot access to the product API, so the Inventory product is not being created (and the service not being activated).

Can you check in the glassfish logs if there is any error?

Urtza2 commented 5 years ago

Hi @fdelavega, Yes I know that something is not working with this. I am looking into " ..../business-ecosystem-charging-backend/src/wstore/rss_adaptor/rss_manager.py" file debugging code using prints but I have not any idea to solve it. I think that is the last issue that I have to solve to obtain a CKAN Monetization working well. I have changes WSTOREMAIL and WSTOREMAILPASS from settings.py (business-charging-backend) I have the following logs in glasshfish:

server.log main.log

Please help me with this.

Thanks a lot. Urtza

Urtza2 commented 5 years ago

Hi again, How can I check that Inventory product is not being created (and the service not being activated)? I following the buying of an offer when the user clicks on "Checkout", the response is 200- OK. But then I don't know to which part of the code is redirected to create product Inventory in Mysql database. Can you tell me in order to debug and try to solve it? Thanks again.

fdelavega commented 5 years ago

Hi,

When an Order (In the TMF ordering API, deployed in Glassfish) is set in completed state (this is automatic for digital products such as data), it automatically creates a Product object in the inventory API (Also TMForum stuff). This object basically includes all the chosen stuff, characteristics, the pricing, etc, and represent an acquired product.

The charging backend is subscribed to the creation of products in the inventory, so when it receives the notification it activates the acquired service, calling the on_product_acquired handler in the particular plugin. Is in this step where the user is included to the access list in CKAN, and the role is granted in the IDM for accessing to the context broker (when used).

The Ordering API has a configuration file located within the project including the URL of the inventory. (https://github.com/FIWARE-TMForum/DSPRODUCTORDERING/blob/master/src/main/java/org/tmf/dsmapi/settings.properties this file).

If the inventory is not in localhost:8080, then this should be updated and the API redeployed. In addition, you can have a look at the Glassfish logs to see if an error happened when creating the product.

Urtza2 commented 5 years ago

Hi , I had another service in port 8080 and decided to change the glassfish port to 8085. I had no idea that internally this could affect but I see that yes. It would be good if you indicated in the documentation that if the port is changed there would be problems. Finally everything has finished as I wanted, I knew it had to be a very simple thing but I did not get it. Thank you very much for everything. I can already feel calm with the result of my work.

Best regards, Urtza