Search in sources :

Example 11 with SMPHttpResponseHandlerWriteOperations

use of com.helger.smpclient.httpclient.SMPHttpResponseHandlerWriteOperations in project peppol-commons by phax.

the class BDXR2Client method deleteServiceRegistration.

/**
 * Deletes a service meta data object given by its service group id and its
 * document type.
 *
 * @param aServiceGroupID
 *        The service group id of the service meta data to delete. May not be
 *        <code>null</code>.
 * @param aDocumentTypeID
 *        The document type of the service meta data to delete. 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
 *         The service meta data object did not exist.
 * @throws SMPClientBadRequestException
 *         The request was not well formed.
 */
public void deleteServiceRegistration(@Nonnull final IParticipantIdentifier aServiceGroupID, @Nonnull final IDocumentTypeIdentifier aDocumentTypeID, @Nonnull final BasicAuthClientCredentials aCredentials) throws SMPClientException {
    ValueEnforcer.notNull(aServiceGroupID, "ServiceGroupID");
    ValueEnforcer.notNull(aDocumentTypeID, "DocumentTypeID");
    ValueEnforcer.notNull(aCredentials, "Credentials");
    final String sURI = getSMPHostURI() + PATH_OASIS_BDXR_SMP_2 + aServiceGroupID.getURIPercentEncoded() + '/' + URL_PART_SERVICES + '/' + aDocumentTypeID.getURIPercentEncoded();
    if (LOGGER.isDebugEnabled())
        LOGGER.debug("BDXR2Client deleteServiceRegistration@" + sURI);
    final HttpDelete aRequest = new HttpDelete(sURI);
    aRequest.addHeader(CHttpHeader.AUTHORIZATION, aCredentials.getRequestValue());
    executeGenericRequest(aRequest, new SMPHttpResponseHandlerWriteOperations());
}
Also used : HttpDelete(org.apache.http.client.methods.HttpDelete) SMPHttpResponseHandlerWriteOperations(com.helger.smpclient.httpclient.SMPHttpResponseHandlerWriteOperations)

Example 12 with SMPHttpResponseHandlerWriteOperations

use of com.helger.smpclient.httpclient.SMPHttpResponseHandlerWriteOperations in project peppol-commons by phax.

the class BDXR2Client method deleteServiceGroup.

/**
 * Deletes a service group given by its service group id.
 *
 * @param aServiceGroupID
 *        The service group id of the service group to delete. 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 SMPClientNotFoundException
 *         The service group id did not exist.
 * @throws SMPClientUnauthorizedException
 *         The user name or password was not correct.
 * @throws SMPClientBadRequestException
 *         The request was not well formed.
 */
public void deleteServiceGroup(@Nonnull final IParticipantIdentifier aServiceGroupID, @Nonnull final BasicAuthClientCredentials aCredentials) throws SMPClientException {
    ValueEnforcer.notNull(aCredentials, "Credentials");
    final String sURI = getSMPHostURI() + PATH_OASIS_BDXR_SMP_2 + aServiceGroupID.getURIPercentEncoded();
    if (LOGGER.isDebugEnabled())
        LOGGER.debug("BDXR2Client deleteServiceGroup@" + sURI);
    final HttpDelete aRequest = new HttpDelete(sURI);
    aRequest.addHeader(CHttpHeader.AUTHORIZATION, aCredentials.getRequestValue());
    executeGenericRequest(aRequest, new SMPHttpResponseHandlerWriteOperations());
}
Also used : HttpDelete(org.apache.http.client.methods.HttpDelete) SMPHttpResponseHandlerWriteOperations(com.helger.smpclient.httpclient.SMPHttpResponseHandlerWriteOperations)

Aggregations

SMPHttpResponseHandlerWriteOperations (com.helger.smpclient.httpclient.SMPHttpResponseHandlerWriteOperations)12 HttpDelete (org.apache.http.client.methods.HttpDelete)6 HttpPut (org.apache.http.client.methods.HttpPut)6 StringEntity (org.apache.http.entity.StringEntity)6 BDXR1MarshallerServiceGroupType (com.helger.smpclient.bdxr1.marshal.BDXR1MarshallerServiceGroupType)1 BDXR1MarshallerServiceMetadataType (com.helger.smpclient.bdxr1.marshal.BDXR1MarshallerServiceMetadataType)1 BDXR2ServiceGroupMarshaller (com.helger.smpclient.bdxr2.marshal.BDXR2ServiceGroupMarshaller)1 BDXR2ServiceMetadataMarshaller (com.helger.smpclient.bdxr2.marshal.BDXR2ServiceMetadataMarshaller)1 SMPMarshallerServiceGroupType (com.helger.smpclient.peppol.marshal.SMPMarshallerServiceGroupType)1 SMPMarshallerServiceMetadataType (com.helger.smpclient.peppol.marshal.SMPMarshallerServiceMetadataType)1