use of com.helger.smpclient.peppol.marshal.SMPMarshallerCompleteServiceGroupType in project peppol-commons by phax.
the class SMPClientReadOnly method getCompleteServiceGroup.
/**
* Returns a complete service group. A complete service group contains both
* the service group and the service metadata. This is a non-specification
* compliant method.<br>
* NOTE: this API is NOT supported by all SMP implementations. It is based on
* a proprietary API provided by the Peppol reference implementation and now
* supported by phoss SMP but not all other SMPs.
*
* @param sCompleteURI
* The complete URL for the full service group to query.
* @return The complete service group containing service group and service
* metadata. Never <code>null</code>.
* @throws SMPClientException
* in case something goes wrong
* @throws SMPClientUnauthorizedException
* A HTTP Forbidden was received, should not happen.
* @throws SMPClientNotFoundException
* The service group id did not exist.
* @throws SMPClientBadRequestException
* The request was not well formed.
* @see #getCompleteServiceGroup(IParticipantIdentifier)
* @see #getCompleteServiceGroupOrNull(IParticipantIdentifier)
*/
@Nonnull
public CompleteServiceGroupType getCompleteServiceGroup(@Nonnull final String sCompleteURI) throws SMPClientException {
ValueEnforcer.notEmpty(sCompleteURI, "CompleteURL");
if (LOGGER.isDebugEnabled())
LOGGER.debug("SMPClient getCompleteServiceGroup@" + sCompleteURI);
final HttpGet aRequest = new HttpGet(sCompleteURI);
final SMPMarshallerCompleteServiceGroupType aMarshaller = new SMPMarshallerCompleteServiceGroupType(isXMLSchemaValidation());
customizeMarshaller(aMarshaller);
return executeGenericRequest(aRequest, new SMPHttpResponseHandlerUnsigned<>(aMarshaller));
}
use of com.helger.smpclient.peppol.marshal.SMPMarshallerCompleteServiceGroupType in project phoss-smp by phax.
the class APIExecutorServiceGroupCompleteGet method invokeAPI.
public void invokeAPI(@Nonnull final IAPIDescriptor aAPIDescriptor, @Nonnull @Nonempty final String sPath, @Nonnull final Map<String, String> aPathVariables, @Nonnull final IRequestWebScopeWithoutResponse aRequestScope, @Nonnull final UnifiedResponse aUnifiedResponse) throws Exception {
final String sPathServiceGroupID = aPathVariables.get(SMPRestFilter.PARAM_SERVICE_GROUP_ID);
final ISMPServerAPIDataProvider aDataProvider = new SMPRestDataProvider(aRequestScope, sPathServiceGroupID);
final byte[] aBytes;
switch(SMPServerConfiguration.getRESTType()) {
case PEPPOL:
{
// Unspecified extension
final com.helger.xsds.peppol.smp1.CompleteServiceGroupType ret = new SMPServerAPI(aDataProvider).getCompleteServiceGroup(sPathServiceGroupID);
aBytes = new SMPMarshallerCompleteServiceGroupType(XML_SCHEMA_VALIDATION).getAsBytes(ret);
break;
}
case OASIS_BDXR_V1:
{
// Unspecified extension
final com.helger.xsds.bdxr.smp1.CompleteServiceGroupType ret = new BDXR1ServerAPI(aDataProvider).getCompleteServiceGroup(sPathServiceGroupID);
aBytes = new BDXR1MarshallerCompleteServiceGroupType(XML_SCHEMA_VALIDATION).getAsBytes(ret);
break;
}
default:
throw new UnsupportedOperationException("Unsupported REST type specified!");
}
if (aBytes == null) {
// Internal error serializing the payload
throw new SMPInternalErrorException("Failed to convert the returned CompleteServiceGroup to XML");
}
aUnifiedResponse.setContent(aBytes).setMimeType(CMimeType.TEXT_XML).setCharset(XMLWriterSettings.DEFAULT_XML_CHARSET_OBJ);
}
Aggregations