use of com.helger.peppolid.simple.participant.SimpleParticipantIdentifier in project peppol-commons by phax.
the class ManageParticipantIdentifierServiceCaller method create.
/**
* Creates a new participant identifier for the SMP given by the ID.
*
* @param sSMPID
* Identifies the SMP to create the identifier for. Example:
* <code>test-smp-0000000001</code>
* @param aIdentifier
* The identifier to be created. May not be <code>null</code>.
* @throws BadRequestFault
* Is thrown if the request sent to the service was not well-formed.
* @throws InternalErrorFault
* Is thrown if an internal error happened on the service.
* @throws UnauthorizedFault
* Is thrown if the user was not authorized.
* @throws NotFoundFault
* Is thrown if the service meta data publisher was not found.
*/
public void create(@Nonnull @Nonempty final String sSMPID, @Nonnull final IParticipantIdentifier aIdentifier) throws BadRequestFault, InternalErrorFault, UnauthorizedFault, NotFoundFault {
ValueEnforcer.notEmpty(sSMPID, "SMPID");
ValueEnforcer.notNull(aIdentifier, "Identifier");
final ServiceMetadataPublisherServiceForParticipantType aSMPParticpantService = new ServiceMetadataPublisherServiceForParticipantType();
aSMPParticpantService.setServiceMetadataPublisherID(sSMPID);
// Constructor call needed for type conversion
aSMPParticpantService.setParticipantIdentifier(new SimpleParticipantIdentifier(aIdentifier));
create(aSMPParticpantService);
}
use of com.helger.peppolid.simple.participant.SimpleParticipantIdentifier in project peppol-commons by phax.
the class SMLFuncTest method testManageBusinessIdentifier.
@Test
public void testManageBusinessIdentifier() throws Exception {
final ManageParticipantIdentifierServiceCaller aPIClient = new ManageParticipantIdentifierServiceCaller(SML_INFO);
aPIClient.setSSLSocketFactory(createConfiguredSSLSocketFactory(SML_INFO, false));
final IParticipantIdentifier aBusinessIdentifierCreate = PeppolIdentifierFactory.INSTANCE.createParticipantIdentifierWithDefaultScheme(TEST_BUSINESS_IDENTIFIER1);
final ServiceMetadataPublisherServiceForParticipantType saSrviceMetadataPublisherServiceForBusiness = new ServiceMetadataPublisherServiceForParticipantType();
// Explicit constructor call needed for type conversion
saSrviceMetadataPublisherServiceForBusiness.setParticipantIdentifier(new SimpleParticipantIdentifier(aBusinessIdentifierCreate));
saSrviceMetadataPublisherServiceForBusiness.setServiceMetadataPublisherID(m_aServiceMetadataPublisher.getServiceMetadataPublisherID());
aPIClient.create(saSrviceMetadataPublisherServiceForBusiness);
final ParticipantIdentifierPageType aResult = aPIClient.list("", m_aServiceMetadataPublisher.getServiceMetadataPublisherID());
assertNotNull(aResult);
final List<ParticipantIdentifierType> aBusinessIdentifiers = aResult.getParticipantIdentifier();
assertEquals(1, aBusinessIdentifiers.size());
final ParticipantIdentifierType aBusinessIdentifierRead = aBusinessIdentifiers.get(0);
assertEquals(aBusinessIdentifierCreate.getScheme(), aBusinessIdentifierRead.getScheme());
assertEquals(aBusinessIdentifierCreate.getValue(), aBusinessIdentifierRead.getValue());
aPIClient.deleteList(aBusinessIdentifiers);
m_aSMClient.delete(m_aServiceMetadataPublisher.getServiceMetadataPublisherID());
}
use of com.helger.peppolid.simple.participant.SimpleParticipantIdentifier in project peppol-commons by phax.
the class ManageParticipantIdentifierServiceCaller method delete.
/**
* Deletes a given participant identifier. <br>
* This is a workaround for a bug in CIPA SMK 3.0 which requires the SMP ID.
* Previously it was never needed!
*
* @param sSMPID
* The id of the service meta data. May neither be <code>null</code>
* nor empty.
* @param aIdentifier
* The business identifier to delete. May not be <code>null</code>.
* @throws BadRequestFault
* Is thrown if the request sent to the service was not well-formed.
* @throws InternalErrorFault
* Is thrown if an internal error happened on the service.
* @throws NotFoundFault
* Is thrown if the business identifier could not be found and
* therefore deleted.
* @throws UnauthorizedFault
* Is thrown if the user was not authorized.
*/
public void delete(@Nonnull @Nonempty final String sSMPID, @Nonnull final IParticipantIdentifier aIdentifier) throws BadRequestFault, InternalErrorFault, NotFoundFault, UnauthorizedFault {
ValueEnforcer.notNull(aIdentifier, "Identifier");
final ServiceMetadataPublisherServiceForParticipantType aSMPParticpantService = new ServiceMetadataPublisherServiceForParticipantType();
aSMPParticpantService.setServiceMetadataPublisherID(sSMPID);
// Constructor call needed for type conversion
aSMPParticpantService.setParticipantIdentifier(new SimpleParticipantIdentifier(aIdentifier));
delete(aSMPParticpantService);
}
use of com.helger.peppolid.simple.participant.SimpleParticipantIdentifier in project peppol-commons by phax.
the class ManageParticipantIdentifierServiceCaller method createList.
/**
* Creates a list of participant identifiers.
*
* @param aParticipantIdentifiers
* The collection of identifiers to create. May neither be
* <code>null</code> nor empty nor may it contain <code>null</code>
* values.
* @param sSMPID
* The id of the service meta data. May neither be <code>null</code>
* nor empty.
* @throws BadRequestFault
* Is thrown if the request sent to the service was not well-formed.
* @throws InternalErrorFault
* Is thrown if an internal error happened on the service.
* @throws NotFoundFault
* If the SMP does not exist
* @throws UnauthorizedFault
* Is thrown if the user was not authorized.
*/
public void createList(@Nonnull @Nonempty final Iterable<? extends IParticipantIdentifier> aParticipantIdentifiers, @Nonnull @Nonempty final String sSMPID) throws BadRequestFault, InternalErrorFault, NotFoundFault, UnauthorizedFault {
ValueEnforcer.notEmptyNoNullValue(aParticipantIdentifiers, "ParticipantIdentifiers");
ValueEnforcer.notEmpty(sSMPID, "SMPID");
if (LOGGER.isInfoEnabled())
LOGGER.info("Trying to create multiple new participants " + _toString(aParticipantIdentifiers) + " in SMP '" + sSMPID + "'");
final ParticipantIdentifierPageType aParticipantList = new ParticipantIdentifierPageType();
for (final IParticipantIdentifier aPI : aParticipantIdentifiers) {
// Constructor call needed for type conversion
aParticipantList.addParticipantIdentifier(new SimpleParticipantIdentifier(aPI));
}
aParticipantList.setServiceMetadataPublisherID(sSMPID);
createWSPort().createList(aParticipantList);
}
use of com.helger.peppolid.simple.participant.SimpleParticipantIdentifier in project peppol-commons by phax.
the class BPCURLProviderSMP2Test method testGetSMPURIOfParticipant.
@Test
@Ignore("Because it may take long to execute")
@IgnoredNaptrTest
public void testGetSMPURIOfParticipant() throws SMPDNSResolutionException {
final SimpleParticipantIdentifier aPI = new SimpleParticipantIdentifier("urn:oasis:names:tc:ebcore:partyid-type:iso6523:0060", "123456789");
final URI x = BPCURLProviderSMP2.INSTANCE.getSMPURIOfParticipant(aPI, "bpc02.b2bei.us.");
assertEquals("https://bpc-smp.bdxhub.com/", x.toString());
}
Aggregations