use of com.helger.xsds.peppol.smp1.ServiceMetadataType in project peppol-commons by phax.
the class SMPDebugHelper method getAsString.
@Nonnull
public static String getAsString(@Nonnull final ServiceMetadataType aServiceMetadata) {
final StringBuilder aSB = new StringBuilder();
aSB.append("Service meta data:\n");
final ServiceInformationType aServiceInformation = aServiceMetadata.getServiceInformation();
if (aServiceInformation != null) {
aSB.append(" Service information:\n");
aSB.append(" Participant: ").append(CIdentifier.getURIEncoded(aServiceInformation.getParticipantIdentifier())).append('\n');
aSB.append(" Document type: ").append(CIdentifier.getURIEncoded(aServiceInformation.getDocumentIdentifier())).append('\n');
for (final ProcessType aProcess : aServiceInformation.getProcessList().getProcess()) {
aSB.append(" Process: ").append(CIdentifier.getURIEncoded(aProcess.getProcessIdentifier())).append('\n');
for (final EndpointType aEndpoint : aProcess.getServiceEndpointList().getEndpoint()) {
aSB.append(" Endpoint: ").append(W3CEndpointReferenceHelper.getAddress(aEndpoint.getEndpointReference())).append('\n');
aSB.append(" Transport profile: ").append(aEndpoint.getTransportProfile()).append('\n');
aSB.append(" Business level signature: ").append(aEndpoint.isRequireBusinessLevelSignature()).append('\n');
aSB.append(" Min auth level: ").append(aEndpoint.getMinimumAuthenticationLevel()).append('\n');
if (aEndpoint.getServiceActivationDate() != null)
aSB.append(" Valid from: ").append(aEndpoint.getServiceActivationDate()).append('\n');
if (aEndpoint.getServiceExpirationDate() != null)
aSB.append(" Valid to: ").append(aEndpoint.getServiceExpirationDate()).append('\n');
aSB.append(" Certficiate string: ").append(aEndpoint.getCertificate()).append('\n');
aSB.append(" Service description: ").append(aEndpoint.getServiceDescription()).append('\n');
aSB.append(" Contact URL: ").append(aEndpoint.getTechnicalContactUrl()).append('\n');
aSB.append(" Info URL: ").append(aEndpoint.getTechnicalInformationUrl()).append('\n');
}
}
}
final RedirectType aRedirect = aServiceMetadata.getRedirect();
if (aRedirect != null) {
aSB.append(" Service redirect:\n");
aSB.append(" Certificate UID: ").append(aRedirect.getCertificateUID()).append('\n');
aSB.append(" Href: ").append(aRedirect.getHref()).append('\n');
}
return aSB.toString();
}
use of com.helger.xsds.peppol.smp1.ServiceMetadataType in project peppol-commons by phax.
the class BDXRClient method saveServiceInformation.
/**
* Saves a service information data object.
*
* @param aServiceInformation
* The service information object to save. May not be
* <code>null</code>.
* @param aCredentials
* The user name and password to use as credentials. May not be
* <code>null</code>.
* @throws SMPClientException
* in case something goes wrong
* @throws SMPClientUnauthorizedException
* The user name or password was not correct.
* @throws SMPClientNotFoundException
* A HTTP Not Found was received. This can happen if the service was
* not found.
* @throws SMPClientBadRequestException
* The request was not well formed.
* @see #saveServiceRedirect(ParticipantIdentifierType,
* DocumentIdentifierType, RedirectType, BasicAuthClientCredentials)
*/
public void saveServiceInformation(@Nonnull final ServiceInformationType aServiceInformation, @Nonnull final BasicAuthClientCredentials aCredentials) throws SMPClientException {
ValueEnforcer.notNull(aServiceInformation, "ServiceMetadata.ServiceInformation");
ValueEnforcer.notNull(aServiceInformation.getParticipantIdentifier(), "ServiceMetadata.ServiceInformation.ParticipantIdentifier");
ValueEnforcer.notNull(aServiceInformation.getDocumentIdentifier(), "ServiceMetadata.ServiceInformation.DocumentIdentifier");
ValueEnforcer.notNull(aCredentials, "Credentials");
final ServiceMetadataType aServiceMetadata = new ServiceMetadataType();
aServiceMetadata.setServiceInformation(aServiceInformation);
_saveServiceInformation(aServiceInformation.getParticipantIdentifier(), aServiceInformation.getDocumentIdentifier(), aServiceMetadata, aCredentials);
}
use of com.helger.xsds.peppol.smp1.ServiceMetadataType in project peppol-commons by phax.
the class BDXRClient method saveServiceRedirect.
/**
* Saves a redirect data object.
*
* @param aServiceGroupID
* The service group ID to use. May not be <code>null</code>.
* @param aDocumentTypeID
* The document type ID to use. May not be <code>null</code>.
* @param aRedirect
* The redirect to be saved. May not be <code>null</code>.
* @param aCredentials
* The user name and password to use as credentials. May not be
* <code>null</code>.
* @throws SMPClientException
* in case something goes wrong
* @throws SMPClientUnauthorizedException
* The user name or password was not correct.
* @throws SMPClientNotFoundException
* A HTTP Not Found was received. This can happen if the service was
* not found.
* @throws SMPClientBadRequestException
* The request was not well formed.
* @see #saveServiceInformation(ServiceInformationType,
* BasicAuthClientCredentials)
*/
public void saveServiceRedirect(@Nonnull final ParticipantIdentifierType aServiceGroupID, @Nonnull final DocumentIdentifierType aDocumentTypeID, @Nonnull final RedirectType aRedirect, @Nonnull final BasicAuthClientCredentials aCredentials) throws SMPClientException {
ValueEnforcer.notNull(aServiceGroupID, "ServiceGroupID");
ValueEnforcer.notNull(aDocumentTypeID, "DocumentTypeID");
ValueEnforcer.notNull(aRedirect, "Redirect");
ValueEnforcer.notNull(aCredentials, "Credentials");
final ServiceMetadataType aServiceMetadata = new ServiceMetadataType();
aServiceMetadata.setRedirect(aRedirect);
_saveServiceInformation(aServiceGroupID, aDocumentTypeID, aServiceMetadata, aCredentials);
}
use of com.helger.xsds.peppol.smp1.ServiceMetadataType in project peppol-commons by phax.
the class BDXR2Client method saveServiceEndpoints.
/**
* Saves a service information data object.
*
* @param aServiceGroupID
* The service group ID to use. May not be <code>null</code>.
* @param aDocumentTypeID
* The document type ID to use. May not be <code>null</code>.
* @param aEndpoints
* The endpoints to the created or updated. May not be
* <code>null</code>.
* @param aCredentials
* The user name and password to use as credentials. May not be
* <code>null</code>.
* @throws SMPClientException
* in case something goes wrong
* @throws SMPClientUnauthorizedException
* The user name or password was not correct.
* @throws SMPClientNotFoundException
* A HTTP Not Found was received. This can happen if the service was
* not found.
* @throws SMPClientBadRequestException
* The request was not well formed.
* @see #saveServiceRedirect(ParticipantIDType, IDType, RedirectType,
* BasicAuthClientCredentials)
*/
public void saveServiceEndpoints(@Nonnull final ParticipantIDType aServiceGroupID, @Nonnull final IDType aDocumentTypeID, @Nonnull final List<EndpointType> aEndpoints, @Nonnull final BasicAuthClientCredentials aCredentials) throws SMPClientException {
ValueEnforcer.notNull(aServiceGroupID, "ServiceGroupID");
ValueEnforcer.notNull(aDocumentTypeID, "DocumentTypeID");
ValueEnforcer.notNull(aEndpoints, "Endpoints");
ValueEnforcer.notNull(aCredentials, "Credentials");
final ServiceMetadataType aServiceMetadata = new ServiceMetadataType();
aServiceMetadata.setSMPVersionID("2.0");
aServiceMetadata.setID(aDocumentTypeID);
aServiceMetadata.setParticipantID(aServiceGroupID);
final ProcessMetadataType aPM = new ProcessMetadataType();
aPM.getEndpoint().addAll(aEndpoints);
aServiceMetadata.addProcessMetadata(aPM);
_saveServiceInformation(aServiceMetadata, aCredentials);
}
Aggregations