use of org.oasisOpen.docs.wsrf.sg2.EntryType in project midpoint by Evolveum.
the class ParamsTypeUtil method createEntryElement.
private static EntryType createEntryElement(Entry<String, Serializable> entry, PrismContext prismContext) throws SchemaException {
EntryType result = new EntryType();
result.setKey(entry.getKey());
if (XmlTypeConverter.canConvert(entry.getValue().getClass())) {
return createEntryElement(entry.getKey(), entry.getValue());
} else {
RootXNode xnode = prismContext.xnodeSerializer().options(SerializationOptions.createSerializeReferenceNames()).serializeAnyData(entry.getValue(), SchemaConstants.C_PARAM_VALUE);
return createEntryElement(entry.getKey(), new RawType(xnode, prismContext));
}
}
use of org.oasisOpen.docs.wsrf.sg2.EntryType in project tesb-rt-se by Talend.
the class LocatorRestServiceImpl method registerEndpoint.
/**
* Register the endpoint for given service.
*
* @param input
* RegisterEndpointRequestType encapsulate name of service and
* endpointURL. Must not be <code>null</code>
*/
public void registerEndpoint(RegisterEndpointRequest arg0) {
String endpointURL = arg0.getEndpointURL();
QName serviceName = QName.valueOf(arg0.getServiceName());
if (LOG.isLoggable(Level.FINE)) {
LOG.fine("Registering endpoint " + endpointURL + " for service " + serviceName + "...");
}
try {
initLocator();
BindingType bindingType = arg0.getBinding() == null ? BindingType.OTHER : BindingType.valueOf(arg0.getBinding().value());
TransportType transportType = arg0.getTransport() == null ? TransportType.OTHER : TransportType.valueOf(arg0.getTransport().value());
SLPropertiesImpl slProps = null;
if (!arg0.getEntryType().isEmpty()) {
slProps = new SLPropertiesImpl();
List<EntryType> entries = arg0.getEntryType();
for (EntryType entry : entries) {
slProps.addProperty(entry.getKey(), entry.getValue());
}
}
Endpoint simpleEndpoint = new SimpleEndpoint(serviceName, endpointURL, bindingType, transportType, slProps);
locatorClient.register(simpleEndpoint, true);
} catch (ServiceLocatorException e) {
// throw new ServiceLocatorFault(e.getMessage(), e);
throw new WebApplicationException(Response.status(Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build());
} catch (InterruptedException e) {
// throw new InterruptedExceptionFault(e.getMessage(), e);
throw new WebApplicationException(Response.status(Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build());
}
}
use of org.oasisOpen.docs.wsrf.sg2.EntryType in project tesb-rt-se by Talend.
the class LocatorRestServiceTest method registerEndpointWithProps.
@Test
public void registerEndpointWithProps() throws ServiceLocatorException, InterruptedException {
sl.register(endpoint(), EasyMock.eq(true));
EasyMock.expectLastCall();
replayAll();
RegisterEndpointRequest req = new RegisterEndpointRequest();
EntryType entryType = new EntryType();
entryType.setKey("test");
entryType.getValue().add("test");
req.getEntryType().add(entryType);
req.setEndpointURL(ENDPOINTURL);
req.setServiceName(SERVICE_NAME.toString());
lps.registerEndpoint(req);
}
use of org.oasisOpen.docs.wsrf.sg2.EntryType in project tesb-rt-se by Talend.
the class LocatorRestServiceTest method registerEndpointExpectedInterruptedException.
@Test(expected = WebApplicationException.class)
public void registerEndpointExpectedInterruptedException() throws ServiceLocatorException, InterruptedException {
sl.register(endpoint(), EasyMock.eq(true));
EasyMock.expectLastCall().andStubThrow(new InterruptedException("test"));
replayAll();
RegisterEndpointRequest req = new RegisterEndpointRequest();
EntryType entryType = new EntryType();
entryType.setKey("test");
entryType.getValue().add("test");
req.getEntryType().add(entryType);
req.setEndpointURL(ENDPOINTURL);
req.setServiceName(SERVICE_NAME.toString());
lps.registerEndpoint(req);
}
use of org.oasisOpen.docs.wsrf.sg2.EntryType in project tesb-rt-se by Talend.
the class RESTClient method registerEndpointExample.
private void registerEndpointExample(String service, String endpoint, String key, String value) {
System.out.println("------------------------------");
System.out.println("Register service endpoint");
System.out.println("ServiceName: ".concat(service));
System.out.println("EndpointURL: ".concat(endpoint));
System.out.println("Property: " + key + "=" + value);
WebClient wc = WebClient.create(BASE_ADDRESS);
EntryType et = new EntryType();
et.setKey(key);
et.getValue().add(value);
RegisterEndpointRequest registerEndpointRequest = new RegisterEndpointRequest();
registerEndpointRequest.setEndpointURL(endpoint);
registerEndpointRequest.setBinding(BindingType.JAXRS);
registerEndpointRequest.setTransport(TransportType.HTTPS);
registerEndpointRequest.setServiceName(service);
registerEndpointRequest.getEntryType().add(et);
try {
wc.post(registerEndpointRequest);
System.out.println("Endpoint registered successfully");
} catch (WebApplicationException ex) {
System.err.println(ex.getMessage());
}
}
Aggregations