Search in sources :

Example 1 with SLPropertiesType

use of org.talend.schemas.esb.locator._2011._11.SLPropertiesType in project tesb-rt-se by Talend.

the class LocatorSoapServiceImpl method registerEndpoint.

/**
 * Register the endpoint for given service.
 *
 * @param input
 *            RegisterEndpointRequestType encapsulate name of service and
 *            endpointURL. Must not be <code>null</code>
 */
@Override
public void registerEndpoint(QName serviceName, String endpointURL, org.talend.schemas.esb.locator._2011._11.BindingType binding, org.talend.schemas.esb.locator._2011._11.TransportType transport, SLPropertiesType properties) throws ServiceLocatorFault, InterruptedExceptionFault {
    if (LOG.isLoggable(Level.FINE)) {
        LOG.fine("Registering endpoint " + endpointURL + " for service " + serviceName + "...");
    }
    try {
        initLocator();
        BindingType bindingType = binding == null ? BindingType.SOAP11 : BindingType.valueOf(binding.value());
        TransportType transportType = transport == null ? TransportType.HTTP : TransportType.valueOf(transport.value());
        SLPropertiesImpl slProps = null;
        if (properties != null) {
            slProps = new SLPropertiesImpl();
            List<EntryType> entries = properties.getEntry();
            for (EntryType entry : entries) {
                slProps.addProperty(entry.getKey(), entry.getValue());
            }
        }
        SimpleEndpoint eprProvider = new SimpleEndpoint(serviceName, endpointURL, bindingType, transportType, slProps);
        locatorClient.register(eprProvider, true);
    } catch (ServiceLocatorException e) {
        ServiceLocatorFaultDetail serviceFaultDetail = new ServiceLocatorFaultDetail();
        serviceFaultDetail.setLocatorFaultDetail(serviceName.toString() + "throws ServiceLocatorFault");
        throw new ServiceLocatorFault(e.getMessage(), serviceFaultDetail);
    } catch (InterruptedException e) {
        InterruptionFaultDetail interruptionFaultDetail = new InterruptionFaultDetail();
        interruptionFaultDetail.setInterruptionDetail(serviceName.toString() + "throws InterruptionFault");
        throw new InterruptedExceptionFault(e.getMessage(), interruptionFaultDetail);
    }
}
Also used : EntryType(org.talend.schemas.esb.locator._2011._11.EntryType) SimpleEndpoint(org.talend.esb.servicelocator.client.SimpleEndpoint) InterruptionFaultDetail(org.talend.schemas.esb.locator._2011._11.InterruptionFaultDetail) BindingType(org.talend.esb.servicelocator.client.BindingType) ServiceLocatorException(org.talend.esb.servicelocator.client.ServiceLocatorException) SLPropertiesImpl(org.talend.esb.servicelocator.client.SLPropertiesImpl) TransportType(org.talend.esb.servicelocator.client.TransportType) ServiceLocatorFault(org.talend.services.esb.locator.v1.ServiceLocatorFault) InterruptedExceptionFault(org.talend.services.esb.locator.v1.InterruptedExceptionFault) ServiceLocatorFaultDetail(org.talend.schemas.esb.locator._2011._11.ServiceLocatorFaultDetail)

Example 2 with SLPropertiesType

use of org.talend.schemas.esb.locator._2011._11.SLPropertiesType in project tesb-rt-se by Talend.

the class LocatorSoapServiceTest method registerEndpointWithOptionalParameter.

@Test
public void registerEndpointWithOptionalParameter() throws InterruptedExceptionFault, ServiceLocatorFault {
    LocatorSoapServiceImpl lps = new LocatorSoapServiceImpl();
    lps.setLocatorClient(sl);
    SLPropertiesType value = new SLPropertiesType();
    EntryType e = new EntryType();
    e.setKey(PROPERTY_KEY);
    e.getValue().add(PROPERTY_VALUE1);
    e.getValue().add(PROPERTY_VALUE2);
    value.getEntry().add(e);
    lps.registerEndpoint(SERVICE_NAME, ENDPOINTURL, null, null, value);
}
Also used : EntryType(org.talend.schemas.esb.locator._2011._11.EntryType) SLPropertiesType(org.talend.schemas.esb.locator._2011._11.SLPropertiesType) Test(org.junit.Test)

Aggregations

EntryType (org.talend.schemas.esb.locator._2011._11.EntryType)2 Test (org.junit.Test)1 BindingType (org.talend.esb.servicelocator.client.BindingType)1 SLPropertiesImpl (org.talend.esb.servicelocator.client.SLPropertiesImpl)1 ServiceLocatorException (org.talend.esb.servicelocator.client.ServiceLocatorException)1 SimpleEndpoint (org.talend.esb.servicelocator.client.SimpleEndpoint)1 TransportType (org.talend.esb.servicelocator.client.TransportType)1 InterruptionFaultDetail (org.talend.schemas.esb.locator._2011._11.InterruptionFaultDetail)1 SLPropertiesType (org.talend.schemas.esb.locator._2011._11.SLPropertiesType)1 ServiceLocatorFaultDetail (org.talend.schemas.esb.locator._2011._11.ServiceLocatorFaultDetail)1 InterruptedExceptionFault (org.talend.services.esb.locator.v1.InterruptedExceptionFault)1 ServiceLocatorFault (org.talend.services.esb.locator.v1.ServiceLocatorFault)1