Search in sources :

Example 6 with InterruptedExceptionFault

use of org.talend.services.esb.locator.v1.InterruptedExceptionFault in project tesb-rt-se by Talend.

the class LocatorSoapServiceImpl method unregisterEndpoint.

/**
 * Unregister the endpoint for given service.
 *
 * @param input
 *            UnregisterEndpointRequestType encapsulate name of service and
 *            endpointURL. Must not be <code>null</code>
 */
@Override
public void unregisterEndpoint(QName serviceName, String endpointURL) throws ServiceLocatorFault, InterruptedExceptionFault {
    if (LOG.isLoggable(Level.FINE)) {
        LOG.fine("Unregistering endpoint " + endpointURL + " for service " + serviceName + "...");
    }
    try {
        initLocator();
        locatorClient.unregister(serviceName, endpointURL);
    } 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 : InterruptionFaultDetail(org.talend.schemas.esb.locator._2011._11.InterruptionFaultDetail) ServiceLocatorException(org.talend.esb.servicelocator.client.ServiceLocatorException) 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 7 with InterruptedExceptionFault

use of org.talend.services.esb.locator.v1.InterruptedExceptionFault in project tesb-rt-se by Talend.

the class LocatorSoapServiceImpl method lookupEndpoints.

/**
 * For the given service name return list of endpoint references currently
 * registered at the service locator server endpoints.
 *
 * @param serviceName
 *            the name of the service for which to get the endpoints, must
 *            not be <code>null</code>
 * @return EndpointReferenceListType encapsulate list of endpoint references
 *         or <code>null</code>
 */
List<W3CEndpointReference> lookupEndpoints(QName serviceName, MatcherDataType matcherData) throws ServiceLocatorFault, InterruptedExceptionFault {
    SLPropertiesMatcher matcher = createMatcher(matcherData);
    List<String> names = null;
    List<W3CEndpointReference> result = new ArrayList<W3CEndpointReference>();
    String adress;
    try {
        initLocator();
        if (matcher == null) {
            names = locatorClient.lookup(serviceName);
        } else {
            names = locatorClient.lookup(serviceName, matcher);
        }
    } 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);
    }
    if (names != null && !names.isEmpty()) {
        for (int i = 0; i < names.size(); i++) {
            adress = names.get(i);
            result.add(buildEndpoint(serviceName, adress));
        }
    } else {
        if (LOG.isLoggable(Level.WARNING)) {
            LOG.log(Level.WARNING, "lookup Endpoints for " + serviceName + " failed, service is not known.");
        }
        ServiceLocatorFaultDetail serviceFaultDetail = new ServiceLocatorFaultDetail();
        serviceFaultDetail.setLocatorFaultDetail("lookup Endpoint for " + serviceName + " failed, service is not known.");
        throw new ServiceLocatorFault("Can not find Endpoint", serviceFaultDetail);
    }
    return result;
}
Also used : ArrayList(java.util.ArrayList) SLPropertiesMatcher(org.talend.esb.servicelocator.client.SLPropertiesMatcher) ServiceLocatorFault(org.talend.services.esb.locator.v1.ServiceLocatorFault) InterruptedExceptionFault(org.talend.services.esb.locator.v1.InterruptedExceptionFault) SimpleEndpoint(org.talend.esb.servicelocator.client.SimpleEndpoint) SLEndpoint(org.talend.esb.servicelocator.client.SLEndpoint) ServiceLocatorFaultDetail(org.talend.schemas.esb.locator._2011._11.ServiceLocatorFaultDetail) InterruptionFaultDetail(org.talend.schemas.esb.locator._2011._11.InterruptionFaultDetail) W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) ServiceLocatorException(org.talend.esb.servicelocator.client.ServiceLocatorException)

Example 8 with InterruptedExceptionFault

use of org.talend.services.esb.locator.v1.InterruptedExceptionFault in project tesb-rt-se by Talend.

the class ContextListener method contextInitialized.

// This method is invoked when the Web Application
// is ready to service requests
public void contextInitialized(ServletContextEvent event) {
    this.context = event.getServletContext();
    // Output a simple message to the server's console
    System.out.println("The Simple Web App. Is Ready");
    ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("/client.xml");
    LocatorService client = (LocatorService) context.getBean("locatorService");
    String serviceHost = this.context.getInitParameter("serviceHost");
    try {
        client.registerEndpoint(new QName("http://talend.org/esb/examples/", "GreeterService"), serviceHost, BindingType.SOAP_11, TransportType.HTTP, null);
    } catch (InterruptedExceptionFault e) {
        e.printStackTrace();
    } catch (ServiceLocatorFault e) {
        e.printStackTrace();
    }
}
Also used : ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext) QName(javax.xml.namespace.QName) LocatorService(org.talend.services.esb.locator.v1.LocatorService) ServiceLocatorFault(org.talend.services.esb.locator.v1.ServiceLocatorFault) InterruptedExceptionFault(org.talend.services.esb.locator.v1.InterruptedExceptionFault)

Aggregations

InterruptedExceptionFault (org.talend.services.esb.locator.v1.InterruptedExceptionFault)8 ServiceLocatorFault (org.talend.services.esb.locator.v1.ServiceLocatorFault)8 ServiceLocatorException (org.talend.esb.servicelocator.client.ServiceLocatorException)6 InterruptionFaultDetail (org.talend.schemas.esb.locator._2011._11.InterruptionFaultDetail)6 ServiceLocatorFaultDetail (org.talend.schemas.esb.locator._2011._11.ServiceLocatorFaultDetail)6 QName (javax.xml.namespace.QName)2 ClassPathXmlApplicationContext (org.springframework.context.support.ClassPathXmlApplicationContext)2 SLEndpoint (org.talend.esb.servicelocator.client.SLEndpoint)2 SLPropertiesMatcher (org.talend.esb.servicelocator.client.SLPropertiesMatcher)2 SimpleEndpoint (org.talend.esb.servicelocator.client.SimpleEndpoint)2 LocatorService (org.talend.services.esb.locator.v1.LocatorService)2 ArrayList (java.util.ArrayList)1 DOMResult (javax.xml.transform.dom.DOMResult)1 W3CEndpointReference (javax.xml.ws.wsaddressing.W3CEndpointReference)1 W3CEndpointReferenceBuilder (javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder)1 BindingType (org.talend.esb.servicelocator.client.BindingType)1 SLProperties (org.talend.esb.servicelocator.client.SLProperties)1 SLPropertiesImpl (org.talend.esb.servicelocator.client.SLPropertiesImpl)1 TransportType (org.talend.esb.servicelocator.client.TransportType)1 EndpointTransformerImpl (org.talend.esb.servicelocator.client.internal.EndpointTransformerImpl)1