javax.xml.rpc.ServiceException Java Examples

The following examples show how to use javax.xml.rpc.ServiceException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: IndexerBase.java    From webcurator with Apache License 2.0 6 votes vote down vote up
@Override
public final void markComplete(Long harvestResultOid) throws ServiceException { 
	
	synchronized(Indexer.lock)
	{
		if(Indexer.lastRunningIndex(this.getName(), harvestResultOid))
		{
	        log.info("Marking harvest result for job " + getResult().getTargetInstanceOid() + " as ready");
	        
	        WCTSoapCall call3 = getCall("finaliseIndex");
	        call3.infiniteRetryingInvoke(30000l, harvestResultOid);
			
			log.info("Index for job " + getResult().getTargetInstanceOid() + " is now ready");
		}

       	Indexer.removeRunningIndex(getName(), harvestResultOid);
	}
}
 
Example #2
Source File: SeiFactoryImpl.java    From tomee with Apache License 2.0 6 votes vote down vote up
public Remote createServiceEndpoint() throws ServiceException {
        //TODO figure out why this can't be called in readResolve!
//        synchronized (this) {
//            if (!initialized) {
//                initialize();
//                initialized = true;
//            }
//        }
        Service service = ((ServiceImpl) serviceImpl).getService();
        GenericServiceEndpoint serviceEndpoint = new GenericServiceEndpoint(portQName, service, location);
        Callback callback = new ServiceEndpointMethodInterceptor(serviceEndpoint, sortedOperationInfos, credentialsName);
        Callback[] callbacks = new Callback[]{NoOp.INSTANCE, callback};
        Enhancer.registerCallbacks(serviceEndpointClass, callbacks);
        try {
            return (Remote) constructor.newInstance(new Object[]{serviceEndpoint});
        } catch (InvocationTargetException e) {
            throw (ServiceException) new ServiceException("Could not construct service instance", e.getTargetException()).initCause(e);
        }
    }
 
Example #3
Source File: ServiceProxy.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
/**
 * @param args Method call arguments
 * @return Returns the correct Port
 * @throws ServiceException if port's QName is an unknown Port (not defined in WSDL).
 */
@SuppressWarnings("unchecked")
private Object getProxyPortQNameClass(Object[] args)
throws ServiceException {
    QName name = (QName) args[0];
    String nameString = name.getLocalPart();
    Class<?> serviceendpointClass = (Class<?>) args[1];

    for (Iterator<QName> ports = service.getPorts(); ports.hasNext();) {
        QName portName = ports.next();
        String portnameString = portName.getLocalPart();
        if (portnameString.equals(nameString)) {
            return service.getPort(name, serviceendpointClass);
        }
    }

    // no ports have been found
    throw new ServiceException("Port-component-ref : " + name + " not found");
}
 
Example #4
Source File: DocumentExecuteServiceProxy.java    From Knowage-Server with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
    * LookUp Method
    * @return
    * @throws SecurityException
    */
   private it.eng.spagobi.services.execute.stub.DocumentExecuteService lookUp() throws SecurityException {
try {
    DocumentExecuteServiceServiceLocator locator = new DocumentExecuteServiceServiceLocator();
    it.eng.spagobi.services.execute.stub.DocumentExecuteService service=null;
    if (serviceUrl!=null ){
	    service = locator.getDocumentExecuteService(serviceUrl);		
    }else {
	    service = locator.getDocumentExecuteService();		
    }
    return service;
} catch (ServiceException e) {
	logger.error("Impossible to locate [" + SERVICE_NAME + "] at [" + serviceUrl + "]");
    throw new SecurityException("Impossible to locate [" + SERVICE_NAME + "] at [" + serviceUrl + "]", e);
}
   }
 
Example #5
Source File: ArtifactServiceProxy.java    From Knowage-Server with GNU Affero General Public License v3.0 6 votes vote down vote up
private it.eng.spagobi.services.artifact.stub.ArtifactService lookUp()
		throws SecurityException {
	try {
		ArtifactServiceServiceLocator locator = new ArtifactServiceServiceLocator();
		it.eng.spagobi.services.artifact.stub.ArtifactService service = null;
		if (serviceUrl != null) {
			service = locator.getArtifactService(serviceUrl);
		} else {
			service = locator.getArtifactService();
		}
		return service;
	} catch (ServiceException e) {
		logger.error("Impossible to locate [" + SERVICE_NAME + "] at ["
				+ serviceUrl + "]");
		throw new SecurityException("Impossible to locate [" + SERVICE_NAME
				+ "] at [" + serviceUrl + "]", e);
	}
}
 
Example #6
Source File: ServiceProxy.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
/**
 * @param args Method call arguments
 * @return Returns the correct Port
 * @throws ServiceException if port's QName is an unknown Port (not defined in WSDL).
 */
@SuppressWarnings("unchecked")
private Object getProxyPortQNameClass(Object[] args)
throws ServiceException {
    QName name = (QName) args[0];
    String nameString = name.getLocalPart();
    Class<?> serviceendpointClass = (Class<?>) args[1];

    for (Iterator<QName> ports = service.getPorts(); ports.hasNext();) {
        QName portName = ports.next();
        String portnameString = portName.getLocalPart();
        if (portnameString.equals(nameString)) {
            return service.getPort(name, serviceendpointClass);
        }
    }

    // no ports have been found
    throw new ServiceException("Port-component-ref : " + name + " not found");
}
 
Example #7
Source File: ServiceProxy.java    From Tomcat8-Source-Read with MIT License 6 votes vote down vote up
/**
 * @param args Method call arguments
 * @return Returns the correct Port
 * @throws ServiceException if port's QName is an unknown Port (not defined in WSDL).
 */
private Object getProxyPortQNameClass(Object[] args) throws ServiceException {
    QName name = (QName) args[0];
    String nameString = name.getLocalPart();
    Class<?> serviceendpointClass = (Class<?>) args[1];

    for (@SuppressWarnings("unchecked") Iterator<QName> ports = service.getPorts(); ports.hasNext();) {
        QName portName = ports.next();
        String portnameString = portName.getLocalPart();
        if (portnameString.equals(nameString)) {
            return service.getPort(name, serviceendpointClass);
        }
    }

    // no ports have been found
    throw new ServiceException(sm.getString("serviceProxy.portNotFound", name));
}
 
Example #8
Source File: JPlagTypImpl.java    From jplag with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Initializes the web service and starts the main thread
 */
public void init(Object context) throws ServiceException {
	servletEndpointContext = (ServletEndpointContext) context;

	// ensure that entry and result directories exist
	AccessStructure.ensureExistence();

	// create and start jplagCentral thread
	JPLAG_CENTRAL = JPlagCentral.getInstance();
	JPLAG_CENTRAL.start();
}
 
Example #9
Source File: ServiceProxy.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
/**
 * @param args Method call arguments
 * @return Returns the correct Port
 * @throws ServiceException if port's QName is an unknown Port
 */
private Remote getProxyPortClass(Object[] args) 
throws ServiceException {
    Class<?> serviceendpointClass = (Class<?>) args[0];

    if (this.portComponentRef == null)
        return service.getPort(serviceendpointClass);

    QName portname = this.portComponentRef.get(serviceendpointClass.getName());
    if (portname != null) {
        return service.getPort(portname, serviceendpointClass);
    } else {
        return service.getPort(serviceendpointClass);
    }
}
 
Example #10
Source File: ServiceProxy.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
/**
 * @param args Method call arguments
 * @return Returns the correct Port
 * @throws ServiceException if port's QName is an unknown Port
 */
private Remote getProxyPortClass(Object[] args) 
throws ServiceException {
    Class<?> serviceendpointClass = (Class<?>) args[0];

    if (this.portComponentRef == null)
        return service.getPort(serviceendpointClass);

    QName portname = this.portComponentRef.get(serviceendpointClass.getName());
    if (portname != null) {
        return service.getPort(portname, serviceendpointClass);
    } else {
        return service.getPort(serviceendpointClass);
    }
}
 
Example #11
Source File: ServiceProxy.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
/**
 * Constructs a new ServiceProxy wrapping given Service instance.
 * @param service the wrapped Service instance
 * @throws ServiceException should be never thrown
 */
public ServiceProxy(Service service) throws ServiceException {
    this.service = service;
    try {
        portQNameClass = Service.class.getDeclaredMethod("getPort", new Class[]{QName.class, Class.class});
        portClass = Service.class.getDeclaredMethod("getPort", new Class[]{Class.class});
    } catch (Exception e) {
        throw new ServiceException(e);
    }
}
 
Example #12
Source File: ServiceProxy.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
/**
 * Constructs a new ServiceProxy wrapping given Service instance.
 * @param service the wrapped Service instance
 * @throws ServiceException should be never thrown
 */
public ServiceProxy(Service service) throws ServiceException {
    this.service = service;
    try {
        portQNameClass = Service.class.getDeclaredMethod("getPort", new Class[]{QName.class, Class.class});
        portClass = Service.class.getDeclaredMethod("getPort", new Class[]{Class.class});
    } catch (Exception e) {
        throw new ServiceException(e);
    }
}
 
Example #13
Source File: ServiceImpl.java    From tomee with Apache License 2.0 5 votes vote down vote up
Remote internalGetPortFromClassName(String className) throws ServiceException {
    if (seiClassNameToFactoryMap.containsKey(className)) {
        SeiFactory seiFactory = (SeiFactory) seiClassNameToFactoryMap.get(className);
        Remote port = seiFactory.createServiceEndpoint();
        return port;
    }
    throw new ServiceException("no port for class " + className);
}
 
Example #14
Source File: MetamodelServiceProxy.java    From Knowage-Server with GNU Affero General Public License v3.0 5 votes vote down vote up
private it.eng.spagobi.services.metamodel.stub.MetamodelService lookUp() throws SecurityException {
	try {
		MetamodelServiceServiceLocator locator = new MetamodelServiceServiceLocator();
		it.eng.spagobi.services.metamodel.stub.MetamodelService service = null;
		if (serviceUrl != null) {
			service = locator.getMetamodelService(serviceUrl);
		} else {
			service = locator.getMetamodelService();
		}
		return service;
	} catch (ServiceException e) {
		logger.error("Impossible to locate [" + SERVICE_NAME + "] at [" + serviceUrl + "]");
		throw new SecurityException("Impossible to locate [" + SERVICE_NAME + "] at [" + serviceUrl + "]", e);
	}
}
 
Example #15
Source File: WsServlet.java    From tomee with Apache License 2.0 5 votes vote down vote up
public void init(ServletConfig config) throws ServletException {
    this.config = config;

    // this is only used by JaxRPC pojo services
    pojo = createPojoInstance();
    if (pojo instanceof ServiceLifecycle) {
        try {
            ((ServiceLifecycle) pojo).init(new InstanceContext(config.getServletContext()));
        } catch (ServiceException e) {
            throw new ServletException("Unable to initialize ServiceEndpoint", e);
        }
    }
    getService();
}
 
Example #16
Source File: EventServiceProxy.java    From Knowage-Server with GNU Affero General Public License v3.0 5 votes vote down vote up
private it.eng.spagobi.services.event.stub.EventService lookUp() throws SecurityException {
try {
    EventServiceServiceLocator locator = new EventServiceServiceLocator();
    it.eng.spagobi.services.event.stub.EventService service = null;
    if (serviceUrl!=null ){
	    service = locator.getEventService(serviceUrl);		
    }else {
	    service = locator.getEventService();		
    }
    return service;
} catch (ServiceException e) {
	logger.error("Impossible to locate [" + SERVICE_NAME + "] at [" + serviceUrl + "]");
    throw new SecurityException("Impossible to locate [" + SERVICE_NAME + "] at [" + serviceUrl + "]", e);
}
   }
 
Example #17
Source File: ServiceProxy.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
/**
 * Constructs a new ServiceProxy wrapping given Service instance.
 * @param service the wrapped Service instance
 * @throws ServiceException should be never thrown
 */
public ServiceProxy(Service service) throws ServiceException {
    this.service = service;
    try {
        portQNameClass = Service.class.getDeclaredMethod("getPort", new Class[]{QName.class, Class.class});
        portClass = Service.class.getDeclaredMethod("getPort", new Class[]{Class.class});
    } catch (Exception e) {
        throw new ServiceException(e);
    }
}
 
Example #18
Source File: DataSourceServiceProxy.java    From Knowage-Server with GNU Affero General Public License v3.0 5 votes vote down vote up
private it.eng.spagobi.services.datasource.stub.DataSourceService lookUp() throws SecurityException {
try {
    DataSourceServiceServiceLocator locator = new DataSourceServiceServiceLocator();
    it.eng.spagobi.services.datasource.stub.DataSourceService service=null;
    if (serviceUrl!=null ){
	    service = locator.getDataSourceService(serviceUrl);		
    }else {
	    service = locator.getDataSourceService();		
    }
    return service;
} catch (ServiceException e) {
    logger.error("Impossible to locate [" + SERVICE_NAME + "] at [" + serviceUrl + "]");
    throw new SecurityException("Impossible to locate [" + SERVICE_NAME + "] at [" + serviceUrl + "]", e);
}
   }
 
Example #19
Source File: ServiceImpl.java    From tomee with Apache License 2.0 5 votes vote down vote up
public Call[] getCalls(QName portName) throws ServiceException {

        if (portName == null) throw new ServiceException("Portname cannot be null");

        SeiFactory factory = (SeiFactory) portToImplementationMap.get(portName.getLocalPart());
        if (factory == null) throw new ServiceException("No port for portname: " + portName);

        OperationInfo[] operationInfos = factory.getOperationInfos();
        javax.xml.rpc.Call[] array = new javax.xml.rpc.Call[operationInfos.length];
        for (int i = 0; i < operationInfos.length; i++) {
            OperationInfo operation = operationInfos[i];
            array[i] = delegate.createCall(factory.getPortQName(), operation.getOperationName());
        }
        return array;
    }
 
Example #20
Source File: ServiceImpl.java    From tomee with Apache License 2.0 5 votes vote down vote up
public Remote getPort(QName qName, Class portClass) throws ServiceException {
    if (qName != null) {
        String portName = qName.getLocalPart();
        Remote port = internalGetPort(portName);
        return port;
    }
    return getPort(portClass);
}
 
Example #21
Source File: ServiceProxy.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
/**
 * @param args Method call arguments
 * @return Returns the correct Port
 * @throws ServiceException if port's QName is an unknown Port
 */
private Remote getProxyPortClass(Object[] args) throws ServiceException {
    Class<?> serviceendpointClass = (Class<?>) args[0];

    if (this.portComponentRef == null) {
        return service.getPort(serviceendpointClass);
    }

    QName portname = this.portComponentRef.get(serviceendpointClass.getName());
    if (portname != null) {
        return service.getPort(portname, serviceendpointClass);
    } else {
        return service.getPort(serviceendpointClass);
    }
}
 
Example #22
Source File: ServiceMethodInterceptor.java    From tomee with Apache License 2.0 5 votes vote down vote up
/**
 *
 * @param o Object
 * @param method Method
 * @param objects Object[]
 * @param methodProxy MethodProxy
 * @return Object
 * @throws Throwable
 */
@Override
public Object intercept(Object o, Method method, Object[] objects, MethodProxy methodProxy) throws Throwable {
    if (objects.length == 0) {
        String methodName = method.getName();
        if (methodName.startsWith("get")) {
            String portName = methodName.substring(3);
            SeiFactory seiFactory = (SeiFactory) seiFactoryMap.get(portName);
            if (seiFactory != null) {
                return seiFactory.createServiceEndpoint();
            }
        }
    }
    throw new ServiceException("Unrecognized method name or argument list: " + method.getName());
}
 
Example #23
Source File: DigitalAssetStoreSOAPClient.java    From webcurator with Apache License 2.0 5 votes vote down vote up
public HarvestResultDTO copyAndPrune(String targetInstanceName, int orgHarvestResultNum, int newHarvestResultNum, List<String> urisToDelete, List<HarvestResourceDTO> hrsToImport) throws DigitalAssetStoreException {
	try {
		WCTSoapCall call = new WCTSoapCall(host, port, service, "copyAndPrune");
		call.regTypes(HarvestResultDTO.class, ArcHarvestResultDTO.class, ArcHarvestFileDTO.class, ArcHarvestResourceDTO.class, HarvestResourceDTO.class);
		return (HarvestResultDTO) call.invoke(targetInstanceName, orgHarvestResultNum, newHarvestResultNum, urisToDelete, hrsToImport);
	}
	catch(ServiceException ex) {
		log.error("Error calling SOAP Service (copyAndPrune): " + ex.getMessage(), ex);
		return null;
	}
       catch (Exception e) {
           throw new DigitalAssetStoreException("Failed to copy and prune " + targetInstanceName + " " + orgHarvestResultNum + ": " + e.getMessage(), e);
       }
}
 
Example #24
Source File: DigitalAssetStoreSOAPClient.java    From webcurator with Apache License 2.0 5 votes vote down vote up
/**
 * @see DigitalAssetStore#purge(String[]).
 */
public void purge(String[] targetInstanceNames) throws DigitalAssetStoreException {
	try {
		WCTSoapCall call = new WCTSoapCall(host, port, service, "purge");		
		call.invoke((Object)targetInstanceNames);
	}
	catch(ServiceException ex) {
		log.error("Error calling SOAP Service (purge): " + ex.getMessage(), ex);			
	}
       catch (Exception e) {
           throw new DigitalAssetStoreException("Failed to purge : " + e.getMessage(), e);
       }
}
 
Example #25
Source File: DigitalAssetStoreSOAPClient.java    From webcurator with Apache License 2.0 5 votes vote down vote up
/**
 * @see DigitalAssetStore#purgeAbortedTargetInstances(String[]).
 */
public void purgeAbortedTargetInstances(String[] targetInstanceNames) throws DigitalAssetStoreException {
	try {
		WCTSoapCall call = new WCTSoapCall(host, port, service, "purgeAbortedTargetInstances");		
		call.invoke((Object)targetInstanceNames);
	}
	catch(ServiceException ex) {
		log.error("Error calling SOAP Service (purgeAbortedTargetInstances): " + ex.getMessage(), ex);			
	}
       catch (Exception e) {
           throw new DigitalAssetStoreException("Failed to purgeAbortedTargetInstances : " + e.getMessage(), e);
       }
}
 
Example #26
Source File: DigitalAssetStoreSOAPClient.java    From webcurator with Apache License 2.0 5 votes vote down vote up
public void submitToArchive(String targetInstanceOid, String SIP, Map xAttributes, int harvestNumber) throws DigitalAssetStoreException {
	try {
		WCTSoapCall call = new WCTSoapCall(host, port, service, "submitToArchive");
		call.invoke(targetInstanceOid, SIP, xAttributes, harvestNumber);
	}
	catch(ServiceException ex) {
		log.error("Error calling SOAP Service (submitToArchive): " + ex.getMessage(), ex);
	}
       catch (Exception e) {
           throw new DigitalAssetStoreException("Failed to submit to archive " + targetInstanceOid + " " + harvestNumber + ": " + e.getMessage(), e);
       }
}
 
Example #27
Source File: IndexerBase.java    From webcurator with Apache License 2.0 5 votes vote down vote up
@Override
public void run() {
   	Long harvestResultOid = null;
       try {
       	harvestResultOid = begin();
       	if(mode == Mode.REMOVE)
       	{
       		removeIndex(harvestResultOid);
       	}
       	else
       	{
			indexFiles(harvestResultOid);
			markComplete(harvestResultOid);
       		
       	}
       }
       catch(ServiceException ex) { 
       	throw new WCTRuntimeException("Service Exception");
       }
       finally
       {
   		synchronized(Indexer.lock)
   		{
   			Indexer.removeRunningIndex(getName(), harvestResultOid);
   		}
       }
}
 
Example #28
Source File: WCTIndexer.java    From webcurator with Apache License 2.0 5 votes vote down vote up
protected Long createIndex() throws ServiceException {
	// Step 1. Save the Harvest Result to the database.
	log.info("Initialising index for job " + getResult().getTargetInstanceOid());
       
       WCTSoapCall call = getCall("createHarvestResult");
       call.regTypes(ArcHarvestResultDTO.class);
       Long harvestResultOid = (Long) call.infiniteRetryingInvoke(30000l, getResult());
       log.info("Initialised index for job " + getResult().getTargetInstanceOid());
       
       return harvestResultOid;
}
 
Example #29
Source File: WCTIndexer.java    From webcurator with Apache License 2.0 5 votes vote down vote up
@Override
public Long begin() throws ServiceException
{
   	Long harvestResultOid = null;
   	if(doCreate) { 
   		harvestResultOid = this.createIndex();
   		log.debug("Created new Harvest Result: " + harvestResultOid);
   	}
   	else {
   		log.debug("Using Harvest Result " + getResult().getOid());
   		harvestResultOid = getResult().getOid();
   	}
   	
   	return harvestResultOid;
}
 
Example #30
Source File: ContentServiceProxy.java    From Knowage-Server with GNU Affero General Public License v3.0 5 votes vote down vote up
private it.eng.spagobi.services.content.stub.ContentService lookUp() throws SecurityException {
try {
    ContentServiceServiceLocator locator = new ContentServiceServiceLocator();
    it.eng.spagobi.services.content.stub.ContentService service=null;
    if (serviceUrl!=null ){
	    service = locator.getContentService(serviceUrl);
    }else {
	    service = locator.getContentService();
    }
    return service;
} catch (ServiceException e) {
    logger.error("Impossible to locate [" + SERVICE_NAME + "] at [" + serviceUrl + "]");
    throw new SecurityException("Impossible to locate [" + SERVICE_NAME + "] at [" + serviceUrl + "]", e);
}
   }