use of com.helger.smpclient.httpclient.SMPHttpResponseHandlerWriteOperations in project peppol-commons by phax.
the class BDXRClient 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() + aServiceGroupID.getURIPercentEncoded();
if (LOGGER.isDebugEnabled())
LOGGER.debug("BDXRClient deleteServiceGroup@" + sURI);
final HttpDelete aRequest = new HttpDelete(sURI);
aRequest.addHeader(CHttpHeader.AUTHORIZATION, aCredentials.getRequestValue());
executeGenericRequest(aRequest, new SMPHttpResponseHandlerWriteOperations());
}
use of com.helger.smpclient.httpclient.SMPHttpResponseHandlerWriteOperations in project peppol-commons by phax.
the class SMPClient method _saveServiceInformation.
private void _saveServiceInformation(@Nonnull final IParticipantIdentifier aServiceGroupID, @Nonnull final IDocumentTypeIdentifier aDocumentTypeID, @Nonnull final ServiceMetadataType aServiceMetadata, @Nonnull final BasicAuthClientCredentials aCredentials) throws SMPClientException {
final String sBody = new SMPMarshallerServiceMetadataType(isXMLSchemaValidation()).getAsString(aServiceMetadata);
if (sBody == null)
throw new IllegalArgumentException("Failed to serialize ServiceMetadata: " + aServiceMetadata);
final String sURI = getSMPHostURI() + aServiceGroupID.getURIPercentEncoded() + "/" + URL_PART_SERVICES + "/" + aDocumentTypeID.getURIPercentEncoded();
if (LOGGER.isDebugEnabled())
LOGGER.debug("SMPClient saveServiceRegistration@" + sURI);
final HttpPut aRequest = new HttpPut(sURI);
aRequest.addHeader(CHttpHeader.AUTHORIZATION, aCredentials.getRequestValue());
aRequest.setEntity(new StringEntity(sBody, CONTENT_TYPE_TEXT_XML));
executeGenericRequest(aRequest, new SMPHttpResponseHandlerWriteOperations());
}
use of com.helger.smpclient.httpclient.SMPHttpResponseHandlerWriteOperations in project peppol-commons by phax.
the class SMPClient method saveServiceGroup.
/**
* Saves a service group. The meta data references should not be set and are
* not used.
*
* @param aServiceGroup
* The service group 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.
*/
public void saveServiceGroup(@Nonnull final ServiceGroupType aServiceGroup, @Nonnull final BasicAuthClientCredentials aCredentials) throws SMPClientException {
ValueEnforcer.notNull(aServiceGroup, "ServiceGroup");
ValueEnforcer.notNull(aCredentials, "Credentials");
final String sBody = new SMPMarshallerServiceGroupType(isXMLSchemaValidation()).getAsString(aServiceGroup);
if (sBody == null)
throw new IllegalArgumentException("Failed to serialize ServiceGroup: " + aServiceGroup);
final String sURI = getSMPHostURI() + CIdentifier.getURIPercentEncoded(aServiceGroup.getParticipantIdentifier());
if (LOGGER.isDebugEnabled())
LOGGER.debug("SMPClient saveServiceGroup@" + sURI);
final HttpPut aRequest = new HttpPut(sURI);
aRequest.addHeader(CHttpHeader.AUTHORIZATION, aCredentials.getRequestValue());
aRequest.setEntity(new StringEntity(sBody, CONTENT_TYPE_TEXT_XML));
executeGenericRequest(aRequest, new SMPHttpResponseHandlerWriteOperations());
}
use of com.helger.smpclient.httpclient.SMPHttpResponseHandlerWriteOperations in project peppol-commons by phax.
the class BDXR2Client method _saveServiceInformation.
private void _saveServiceInformation(@Nonnull final ServiceMetadataType aServiceMetadata, @Nonnull final BasicAuthClientCredentials aCredentials) throws SMPClientException {
final String sBody = new BDXR2ServiceMetadataMarshaller(isXMLSchemaValidation()).getAsString(aServiceMetadata);
if (sBody == null)
throw new IllegalArgumentException("Failed to serialize ServiceMetadata: " + aServiceMetadata);
final String sURI = getSMPHostURI() + PATH_OASIS_BDXR_SMP_2 + CIdentifier.getURIPercentEncoded(aServiceMetadata.getParticipantID()) + '/' + URL_PART_SERVICES + '/' + CIdentifier.getURIPercentEncoded(aServiceMetadata.getID());
if (LOGGER.isDebugEnabled())
LOGGER.debug("BDXR2Client saveServiceRegistration@" + sURI);
final HttpPut aRequest = new HttpPut(sURI);
aRequest.addHeader(CHttpHeader.AUTHORIZATION, aCredentials.getRequestValue());
aRequest.setEntity(new StringEntity(sBody, CONTENT_TYPE_TEXT_XML));
executeGenericRequest(aRequest, new SMPHttpResponseHandlerWriteOperations());
}
use of com.helger.smpclient.httpclient.SMPHttpResponseHandlerWriteOperations in project peppol-commons by phax.
the class BDXR2Client method saveServiceGroup.
/**
* Saves a service group. The meta data references should not be set and are
* not used.
*
* @param aServiceGroup
* The service group 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.
*/
public void saveServiceGroup(@Nonnull final ServiceGroupType aServiceGroup, @Nonnull final BasicAuthClientCredentials aCredentials) throws SMPClientException {
ValueEnforcer.notNull(aServiceGroup, "ServiceGroup");
ValueEnforcer.notNull(aCredentials, "Credentials");
final String sBody = new BDXR2ServiceGroupMarshaller(isXMLSchemaValidation()).getAsString(aServiceGroup);
if (sBody == null)
throw new IllegalArgumentException("Failed to serialize ServiceGroup: " + aServiceGroup);
final String sURI = getSMPHostURI() + PATH_OASIS_BDXR_SMP_2 + CIdentifier.getURIPercentEncoded(aServiceGroup.getParticipantID());
if (LOGGER.isDebugEnabled())
LOGGER.debug("BDXR2Client saveServiceGroup@" + sURI);
final HttpPut aRequest = new HttpPut(sURI);
aRequest.addHeader(CHttpHeader.AUTHORIZATION, aCredentials.getRequestValue());
aRequest.setEntity(new StringEntity(sBody, CONTENT_TYPE_TEXT_XML));
executeGenericRequest(aRequest, new SMPHttpResponseHandlerWriteOperations());
}
Aggregations