Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SMP to PD Indexer not notified after CRUD operation on business card #52

Closed
ssinatti opened this issue Sep 14, 2017 · 18 comments
Closed
Assignees
Milestone

Comments

@ssinatti
Copy link

Good Morning Philip,

After having deployed the last stable version of PHOSS (SMP to SML works correctly), I am trying to integrate, after service group registration called by my platform (NoTI-ER), the service call related to the business card (REST API /businesscard/).
The SMP back-end works correctly and my BC was been created but the problem, afterwards, the SMP (as I would have expected) does not trigger this event to the PD Indexer (like the SML triggering process after CRUD operation on service group).
Question#1: is that process correct?
Question#2: the model represented on documentation declares that the SMP trigger to the Indexer new business card (serviceid -> crud operation) but seems that, this operation is possible only bia Web-UI and is not integrated on the back-end, is that true?
Questione#3: how can i proceed? I think that the best solution is : my client call your API (PUT /businesscard/) and after the CRUD operation on business card the Indexer will be notified, what do you think about it?

Thank you very much for your support.

Stefano

@phax
Copy link
Owner

phax commented Sep 14, 2017

Hi Stefano!

Please check if the "Auto update" is enabled in your settings:
2017-09-14_16h55_26

If yes, we need to dive deeper :)
It the URL already https://directory.peppol.eu?

// Philip

@phax phax self-assigned this Sep 14, 2017
@phax phax added the question label Sep 14, 2017
@ssinatti
Copy link
Author

ssinatti commented Sep 14, 2017

I confirm that on smp-server.properites I have this: smp.peppol.directory.integration.autoupdate=true (I see that by code implementation the default value is "true"), maybe my problem is the API that my client call is not correct? e.g. HTTP PUT http://<smp_phoss_host>/businesscard/{serviceGroupId} [inside xml of business card] (the business card has been created, I have checked on SMP_BCE table but https://test-directory.peppol.eu/public/locale-en_US/menuitem-search?q=9907%3Aphsmra80a01a944s still no have result).

Thank you very much.

Stefano

@phax
Copy link
Owner

phax commented Sep 14, 2017

Okay, good that the settings are okay.
The process for registering an identifier is as follows:

  1. Your SMP makes a signed PUT call to https://test-directory.peppol.eu/indexer/1.0/ with the participant ID as the body
  2. PD puts it in a queue, and if it is about to be processed, PD queries your SMP for the business card of the identifier. This implies, that your identifier MUST be available in the SML/DNS! Otherwise lookup wont work!

hth

@ssinatti
Copy link
Author

Your SMP makes a signed PUT call to https://test-directory.peppol.eu/indexer/1.0/ with the participant ID as the body

It makes sense but my SMP didn't do it, as I wrote before, I have built a simple HTTP Client which calls the /businesscard/ (BusinessCardInterface implementation) rest API for creating the business card (peppol id is registered on SML/DNS https://peppol.helger.com/public/locale-en_US/menuitem-tools-participant?scheme=iso6523-actorid-upis&value=9907%3Aphsmra80a01a944s&sml=digittest&action=perform on SMK), and this step well done correctly, but, the index call service was never perfomed by the SMP, I din't see anything after this on smp log file:

2017-09-14 17:02:01,281 | INFO | [BusinessCard REST API] Finished createBusinessCard(iso6523-actorid-upis::9907:phsmra80a01a944s,[PD1BusinessCardType@0x10dcbc46: participantIdentifier=[PD1IdentifierType@0x704d7255: value=9907:phsmra80a01a944s; scheme=iso6523-actorid-upis]; businessEntity=[[PD1BusinessEntityType@0x398b05b9: name=Peppo Directory 1; countryCode=IT; geographicalInformation=Prova Indirizzo 21; identifier=[[PD1IdentifierType@0x7d8d0425: value=11234; scheme=iso6523-actorid-upis], [PD1IdentifierType@0x0846b95e: value=phshgr80a01a944l; scheme=iso6523-actorid-upis]]; websiteURI=[]; contact=[[PD1ContactType@0x1382add9: type=null; name=Stefano Sinatti; phoneNumber=null; email=null]]; additionalInformation=Test Engineering RER; registrationDate=2017-09-14]]]) | com.helger.peppol.smpserver.restapi.BusinessCardServerAPI | http-bio-9474-exec-1

@phax
Copy link
Owner

phax commented Sep 14, 2017

What you did was to create the BusinessCard in your SMP - fine.
I crosschecked by opening http://193.43.197.92/businesscard/iso6523-actorid-upis%3A%3A9907%3Aphsmra80a01a944s/ in my browser and it looks like a business card :)

And now I get your point: after your HTTP client make the PUT call to create the BC, this is not propagated to PD 👍 I wil check....

@ssinatti
Copy link
Author

ssinatti commented Sep 14, 2017

I crosschecked by opening http://193.43.197.92/businesscard/iso6523-actorid-upis%3A%3A9907%3Aphsmra80a01a944s/ in my browser and it looks like a business card :)

Same for my instance.

And now I get your point: after your HTTP client make the PUT call to create the BC, this is not propagated to PD 👍 I wil check....

That's the point, let me know.

Thank you very much.

Stefano

@phax
Copy link
Owner

phax commented Sep 14, 2017

I confirm this is a bug. As I'm currently doing some major refactorings of base components, it may take some time until the new version is released...

TODO BusinessCardInterface must invoke the respective PDClientProvider.getInstance ().getPDClient () API as the UI does

@phax phax added bug and removed question labels Sep 14, 2017
@phax phax added this to the v5.1 milestone Sep 14, 2017
@ssinatti
Copy link
Author

ssinatti commented Sep 14, 2017

I have tried to modify the implementation of BusinessCardInterface (as finally operation) like this:

> IParticipantIdentifier aPI = PeppolIdentifierFactory.INSTANCE.createParticipantIdentifierWithDefaultScheme (sServiceGroupID);
>         ETriState eNotifiedServer = ETriState.UNDEFINED;
>     	  
>         if (SMPMetaManager.getSettings ().isPEPPOLDirectoryIntegrationAutoUpdate ())
>     	    {
>     	      // Notify PD server
>     	      eNotifiedServer = ETriState.valueOf (PDClientProvider.getInstance ()
>     	                                                           .getPDClient ()
>     	                                                           .addServiceGroupToIndex (aPI)
>     	                                                           .isSuccess ());
>     	      
>     	      s_aLogger.info ("PDClientProvider has notified PD Indexer, addServiceGroupToIndex, RESULT={}",eNotifiedServer.getID());
>     	    		  
>     	    }

and that's on my log file:

2017-09-14 18:15:35,177 | INFO | Before HTTP call: PUT https://test-directory.peppol.eu/indexer/1.0/ (with special HTTP context) | com.helger.httpclient.HttpDebugger | http-bio-9474-exec-1
2017-09-14 18:15:35,904 | INFO | After HTTP call: PUT. Response: SUCCESS | com.helger.httpclient.HttpDebugger | http-bio-9474-exec-1
2017-09-14 18:15:35,905 | INFO | Added service group 'iso6523-actorid-upis::iso6523-actorid-upis::9907:phsmra80a01a944s' to PEPPOL Directory index. May take some time until it shows up. | com.helger.pd.client.PDClient | http-bio-9474-exec-1
2017-09-14 18:15:35,908 | INFO | PDClientProvider has notified PD Indexer, addServiceGroupToIndex, RESULT=true | com.helger.peppol.smpserver.rest.BusinessCardInterface | http-bio-9474-exec-1

but still no have entry on test pd website.

@phax
Copy link
Owner

phax commented Sep 14, 2017

Good guess, but now the index participant ID is iso6523-actorid-upis::iso6523-actorid-upis::9907:phsmra80a01a944s which of course fails, because of duplicate scheme :)

So instead of createParticipantIdentifierWithDefaultScheme use parseParticipantIdentifier and try again :)

@ssinatti
Copy link
Author

Thank you very much Philip, you are great as usual.

Waiting for the next stable version I think it could be good having this solution "injected" on BusinessCardInterface, on finally block I have inserted both logic on createOrupdate/delete and relative PD Idx operation, I know, that's not the best but it works, what do you think?

https://test-directory.peppol.eu/public/locale-en_US/menuitem-search?q=phsmra80a01a944s&action=view&participant=iso6523-actorid-upis%3A%3A9907%3Aphsmra80a01a944s#tab_businessinfo

@phax
Copy link
Owner

phax commented Sep 14, 2017

Looks good to me. This is how I would have done it too. Please send me your changed file. Maybe I can do some patch version inbetween ;)

@ssinatti
Copy link
Author

Dear Philip,

the solution which I have made, I hope this help.

Link

Regards,
Stefano[]

@ssinatti
Copy link
Author

ssinatti commented Sep 25, 2017

Good evening Philip,

Quick update : I have been changing the solution with AOP and build a new one, I have just integrated on BusinessCardInterface during DELETE/UPDATE the pd index call on finally block; I know that it is not the best solution but, I have encountered some problems during integration with my application server (Tomcat) and Aspectj weaver (trying addding the java agent and aop.xml config file but something doesn't work).
So my simplest solution is:

onSave

[...]
 finally
    {
      WebScopeManager.onRequestEnd ();
      //NOTE: NOTIER
      nofityPDIdxOnSave(sServiceGroupID);
    }

private void nofityPDIdxOnSave(final String sServiceGroupID) {
	if (SMPMetaManager.getSettings ().isPEPPOLDirectoryIntegrationAutoUpdate ())
	    {
		  IParticipantIdentifier aPI = PeppolIdentifierFactory.INSTANCE.parseParticipantIdentifier (sServiceGroupID);
         // Notify PD server
         ETriState.valueOf (PDClientProvider.getInstance ()
	                                          .getPDClient ()
	                                          .addServiceGroupToIndex (aPI)
	                                          .isSuccess ());
	          	    		  
	    }
}

onDelete

finally
    {
      WebScopeManager.onRequestEnd ();
      //NOTE: NOTIER
      notifyPDIdxOnDel(sServiceGroupID);
    }

private void notifyPDIdxOnDel(final String sServiceGroupID) {
	if (SMPMetaManager.getSettings ().isPEPPOLDirectoryIntegrationAutoUpdate ())
 	  {
 		 IParticipantIdentifier aPI = PeppolIdentifierFactory.INSTANCE.parseParticipantIdentifier (sServiceGroupID);
 	     // Notify PD server
 		 ETriState eNotifiedServer = ETriState.valueOf (PDClientProvider.getInstance ()
 	                                                           .getPDClient ()
 	                                                           .deleteServiceGroupFromIndex(aPI)
 	                                                           .isSuccess ());
 	        	    		  
 	    }
}

@phax
Copy link
Owner

phax commented Nov 9, 2017

Same after import of Business Cards

@phax
Copy link
Owner

phax commented Feb 13, 2018

Finally resolved :)

@phax phax closed this as completed Feb 13, 2018
@ssinatti
Copy link
Author

Well done Philip!
Have you already planned a new release date?

Thank you in advance.
Stefano

@phax
Copy link
Owner

phax commented Feb 19, 2018

@ssinatti Unfortunately not - I need to add the stuff for the multi root certificate handling as well. But I guess it will be before end of March. Does that help?

@ssinatti
Copy link
Author

Yes, obviously It does!

Thank you very much @phax

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants