use of com.helger.peppol.smlclient.smp.ServiceMetadataPublisherServiceType in project peppol-commons by phax.
the class ManageServiceMetadataServiceCaller method update.
/**
* Updates the specified service metadata given by the publisher id.
*
* @param sSMPID
* The publisher id. May neither be <code>null</code> nor empty.
* @param sSMPAddressPhysical
* The physical address of the SMP (Example: 198.0.0.1). May neither be
* <code>null</code> nor empty.
* @param sSMPAddressLogical
* The logical address of the SMP (Example: http://smp.example.org/).
* May neither be <code>null</code> nor empty.
* @throws InternalErrorFault
* An internal error happened on the server.
* @throws NotFoundFault
* The service metadata with the given publisher id was not found.
* @throws UnauthorizedFault
* The username or password was not correct.
* @throws BadRequestFault
* The request was not well formed.
*/
public void update(@Nonnull @Nonempty final String sSMPID, @Nonnull @Nonempty final String sSMPAddressPhysical, @Nonnull @Nonempty final String sSMPAddressLogical) throws InternalErrorFault, NotFoundFault, UnauthorizedFault, BadRequestFault {
ValueEnforcer.notEmpty(sSMPID, "SMPID");
ValueEnforcer.notEmpty(sSMPAddressPhysical, "SMPAddressPhysical");
ValueEnforcer.notEmpty(sSMPAddressLogical, "SMPAddressLogical");
// Custom validations
validatePhysicalAddress(sSMPAddressPhysical);
validateLogicalAddress(sSMPAddressLogical);
final ServiceMetadataPublisherServiceType aServiceMetadata = new ServiceMetadataPublisherServiceType();
aServiceMetadata.setServiceMetadataPublisherID(sSMPID);
final PublisherEndpointType aEndpoint = new PublisherEndpointType();
aEndpoint.setLogicalAddress(sSMPAddressLogical);
aEndpoint.setPhysicalAddress(sSMPAddressPhysical);
aServiceMetadata.setPublisherEndpoint(aEndpoint);
update(aServiceMetadata);
}
use of com.helger.peppol.smlclient.smp.ServiceMetadataPublisherServiceType in project peppol-commons by phax.
the class ManageServiceMetadataServiceCaller method create.
/**
* Creates the service metadata for the specified user.
*
* @param sSMPID
* The certificate UID of the SMP. May neither be <code>null</code> nor
* empty.
* @param sSMPAddressPhysical
* The physical address of the SMP (Example: 198.0.0.1). May neither be
* <code>null</code> nor empty.
* @param sSMPAddressLogical
* The logical address of the SMP (Example: http://smp.example.org/).
* May neither be <code>null</code> nor empty.
* @throws BadRequestFault
* The request was not well formed.
* @throws InternalErrorFault
* An internal error happened on the server.
* @throws UnauthorizedFault
* The user name or password was not correct.
*/
public void create(@Nonnull @Nonempty final String sSMPID, @Nonnull @Nonempty final String sSMPAddressPhysical, @Nonnull @Nonempty final String sSMPAddressLogical) throws BadRequestFault, InternalErrorFault, UnauthorizedFault {
ValueEnforcer.notEmpty(sSMPID, "SMPID");
ValueEnforcer.notEmpty(sSMPAddressPhysical, "SMPAddressPhysical");
ValueEnforcer.notEmpty(sSMPAddressLogical, "SMPAddressLogical");
// Custom validations
validatePhysicalAddress(sSMPAddressPhysical);
validateLogicalAddress(sSMPAddressLogical);
final ServiceMetadataPublisherServiceType aServiceMetadata = new ServiceMetadataPublisherServiceType();
aServiceMetadata.setServiceMetadataPublisherID(sSMPID);
final PublisherEndpointType aEndpoint = new PublisherEndpointType();
aEndpoint.setLogicalAddress(sSMPAddressLogical);
aEndpoint.setPhysicalAddress(sSMPAddressPhysical);
aServiceMetadata.setPublisherEndpoint(aEndpoint);
create(aServiceMetadata);
}
use of com.helger.peppol.smlclient.smp.ServiceMetadataPublisherServiceType in project peppol-commons by phax.
the class ManageServiceMetadataServiceCaller method read.
/**
* Returns information about the publisher given by the publisher id.
*
* @param sSMPID
* The publisher id of the service metadata to read.
* @return The service metadata given by the id.
* @throws InternalErrorFault
* An internal error happened on the server.
* @throws NotFoundFault
* The service metadata with the given publisher id was not found.
* @throws UnauthorizedFault
* The username or password was not correct.
* @throws BadRequestFault
* The request was not well formed.
*/
@Nonnull
public ServiceMetadataPublisherServiceType read(@Nonnull @Nonempty final String sSMPID) throws InternalErrorFault, NotFoundFault, UnauthorizedFault, BadRequestFault {
ValueEnforcer.notEmpty(sSMPID, "SMPID");
final ServiceMetadataPublisherServiceType aSMPService = new ServiceMetadataPublisherServiceType();
aSMPService.setServiceMetadataPublisherID(sSMPID);
return read(aSMPService);
}
use of com.helger.peppol.smlclient.smp.ServiceMetadataPublisherServiceType in project peppol-commons by phax.
the class SMLFuncTest method testManageServiceMetadata.
@Test
public void testManageServiceMetadata() throws Exception {
final ServiceMetadataPublisherServiceType aServiceMetadataRead = m_aSMClient.read(m_aServiceMetadataPublisher.getServiceMetadataPublisherID());
m_aSMClient.delete(aServiceMetadataRead.getServiceMetadataPublisherID());
assertEquals(m_aServiceMetadataPublisher.getServiceMetadataPublisherID(), aServiceMetadataRead.getServiceMetadataPublisherID());
assertEquals(m_aServiceMetadataPublisher.getPublisherEndpoint().getLogicalAddress(), aServiceMetadataRead.getPublisherEndpoint().getLogicalAddress());
assertEquals(m_aServiceMetadataPublisher.getPublisherEndpoint().getPhysicalAddress(), aServiceMetadataRead.getPublisherEndpoint().getPhysicalAddress());
}
use of com.helger.peppol.smlclient.smp.ServiceMetadataPublisherServiceType in project peppol-commons by phax.
the class SMLFuncTest method testManageServiceMetadataWithManyIdentifier.
@Test
public void testManageServiceMetadataWithManyIdentifier() throws Exception {
final ManageParticipantIdentifierServiceCaller aPIClient = new ManageParticipantIdentifierServiceCaller(SML_INFO);
aPIClient.setSSLSocketFactory(createConfiguredSSLSocketFactory(SML_INFO, false));
final long nStartIdentifier = 5798000999999l;
final int nLastIdentifier = 150;
for (int i = 0; i <= nLastIdentifier; i++) {
LOGGER.info("Creating number: " + i);
final long nIdentifier = nStartIdentifier + i;
aPIClient.create(m_aServiceMetadataPublisher.getServiceMetadataPublisherID(), PeppolIdentifierFactory.INSTANCE.createParticipantIdentifierWithDefaultScheme("0088:" + nIdentifier));
}
m_aSMClient.delete(m_aServiceMetadataPublisher.getServiceMetadataPublisherID());
final ServiceMetadataPublisherServiceType aServiceMetadataCreateNew = _createSMPData(m_aSMClient, SMP_ID);
// Delete one that was on a second page
final long nIdentifier = nStartIdentifier + nLastIdentifier;
aPIClient.create(aServiceMetadataCreateNew.getServiceMetadataPublisherID(), PeppolIdentifierFactory.INSTANCE.createParticipantIdentifierWithDefaultScheme("0088:" + nIdentifier));
}
Aggregations