Java Code Examples for javax.xml.rpc.ServiceException

The following are top voted examples for showing how to use javax.xml.rpc.ServiceException. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: tomcat7   File: ServiceProxy.java   View source code 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 2
Project: lams   File: ServiceProxy.java   View source code 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 (Iterator ports = service.getPorts(); ports.hasNext();) {
        QName portName = (QName) 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 3
Project: apache-tomcat-7.0.73-with-comment   File: ServiceProxy.java   View source code 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
Project: core   File: TrackerWebServicesClient.java   View source code 6 votes vote down vote up
/**
 * Queries the server and returns a list of artifact types.
 * 
 * @return
 * @throws ServiceException
 * @throws WSException
 * @throws RemoteException
 */
public Collection<TrackerArtifactType> getArtifactTypes()
        throws ServiceException, WSException, RemoteException {
    EngineConfiguration config = mClient.getEngineConfiguration();
    MetadataService service = new MetadataServiceLocator(config);
    URL portAddress = mClient.constructServiceURL("/tracker/Metadata");
    Metadata theService = service.getMetadataService(portAddress);
    ArtifactType[] artifactTypes = theService.getArtifactTypes();
    String key;
    for (ArtifactType type : artifactTypes) {
        key = TrackerUtil.getKey(type.getNamespace(), type.getTagName());
        if (repositoryData == null)
            repositoryData = new TrackerClientData();
        if (repositoryData.getArtifactTypeFromKey(key) == null)
            repositoryData.addArtifactType(new TrackerArtifactType(type));
    }

    return repositoryData.getArtifactTypes();
}
 
Example 5
Project: core   File: TrackerWebServicesClient.java   View source code 6 votes vote down vote up
/**
 * Get the metadata for the given artifact. The metadata contains the valid
 * values for attributes and the valid operations that can be performed on
 * the attribute
 * 
 * @param namespace
 * @param artifactType
 * @param artifactId
 * @return
 * @throws ServiceException
 * @throws WSException
 * @throws RemoteException
 */
public ArtifactTypeMetadata getMetaDataForArtifact(String namespace,
        String artifactType, String artifactId) throws ServiceException,
        WSException, RemoteException {
    EngineConfiguration config = mClient.getEngineConfiguration();
    MetadataService service = new MetadataServiceLocator(config);
    URL portAddress = mClient.constructServiceURL("/tracker/Metadata");
    Metadata theService = service.getMetadataService(portAddress);
    TrackerUtil.debug("getMetaDataForArtifact():" + artifactId);
    ArtifactTypeMetadata metaData = theService.getMetadataForArtifact(
            new ArtifactType(artifactType, namespace, ""), artifactId);
    TrackerUtil.debug("getMetaDataForArtifact():done ");
    TrackerArtifactType type = repositoryData
            .getArtifactTypeFromKey(TrackerUtil.getKey(namespace,
                    artifactType));
    if (type == null) {
        type = new TrackerArtifactType(metaData.getArtifactType()
                .getDisplayName(), metaData.getArtifactType().getTagName(),
                metaData.getArtifactType().getNamespace());
    }
    type.populateAttributes(metaData);
    repositoryData.addArtifactType(type);

    return metaData;
}
 
Example 6
Project: core   File: TrackerWebServicesClient.java   View source code 6 votes vote down vote up
/**
 * Attach a file to a PT artifact
 * 
 * @param taskId
 * @param comment
 * @param attachment
 * @throws ServiceException
 * @throws WSException
 * @throws RemoteException
 */
public long postAttachment(String taskId, String comment,
        DataSource attachment) throws ServiceException, WSException,
        RemoteException {
    EngineConfiguration config = mClient.getEngineConfiguration();
    AttachmentService service = new AttachmentServiceLocator(config);
    URL portAddress = mClient.constructServiceURL("/tracker/Attachment");
    AttachmentManager theService = service
            .getAttachmentService(portAddress);
    DataHandler attachmentHandler = new DataHandler(attachment);

    theService.addAttachment(taskId, attachment.getName(), comment,
            attachment.getContentType(), attachmentHandler);
    long[] ids = theService.getAttachmentIds(taskId);
    Arrays.sort(ids);
    return ids[ids.length - 1];
}
 
Example 7
Project: core   File: Connection.java   View source code 6 votes vote down vote up
/**
 * Alternative constructor for test classes
 * 
 * @param serverUrl
 * @param userName
 * @param password
 * @throws ServiceException
 * @throws MalformedURLException
 */
public Connection(String serverUrl, String userName, String password)
        throws ServiceException, MalformedURLException {
    this.username = userName;
    this.password = password;

    Service service = Service.create(new URL(serverUrl), new QName(
            "http://api2.scrumworks.danube.com/",
            "ScrumWorksAPIBeanService"));

    endpoint = service.getPort(ScrumWorksAPIService.class);
    ((BindingProvider) endpoint).getRequestContext().put(
            BindingProvider.USERNAME_PROPERTY, username);
    ((BindingProvider) endpoint).getRequestContext().put(
            BindingProvider.PASSWORD_PROPERTY, password);

}
 
Example 8
Project: core   File: TFSWPAdhocIntegration.java   View source code 6 votes vote down vote up
/**
 * @param args
 * @throws ServiceException
 * @throws RemoteException
 */
public static void main(String[] args) throws ServiceException,
        RemoteException {
    Connection tfcon = Connection.getConnection("https://forge.collab.net",
            "", "", null, null, null, false);
    TrackerClient trackerClient = tfcon.getTrackerClient();
    // end point
    // https://scrumworks.danube.com/scrumworks-api/scrumworks?wsdl
    ScrumWorksServiceLocator locator = new ScrumWorksServiceLocator();
    locator.setScrumWorksEndpointPortEndpointAddress("https://scrumworks.danube.com/scrumworks-api/scrumworks");
    ScrumWorksEndpoint endpoint = locator.getScrumWorksEndpointPort();
    ((ScrumWorksEndpointBindingStub) endpoint).setUsername("");
    ((ScrumWorksEndpointBindingStub) endpoint).setPassword("");
    ProductWSO product = endpoint.getProductByName("SWP-TF Integration");
    BacklogItemWSO[] pbis = endpoint.getActiveBacklogItems(product);

    for (BacklogItemWSO pbi : pbis) {
        trackerClient.createArtifact("tracker2119", pbi.getTitle(),
                pbi.getDescription(), null, null, "Open", null, 2,
                pbi.getEstimate() == null ? 0 : pbi.getEstimate(),
                pbi.getEstimate() == null ? 0 : pbi.getEstimate(), false,
                0, false, null, null, null, null, new FieldValues(), null,
                null, null);
    }
}
 
Example 9
Project: core   File: SWPTester.java   View source code 6 votes vote down vote up
/**
 * Constructor.
 * 
 * @throws IOException
 *             if the property file can not be accessed
 * @throws FileNotFoundException
 *             if the property file can not be found
 * @throws ServiceException
 */
public SWPTester() throws FileNotFoundException, IOException,
        ServiceException {
    Properties prop = new Properties();
    prop.load(new FileInputStream(PROPERTY_FILE));

    setSwpUserName(prop.getProperty(SWP_USER_NAME));
    setSwpPassword(prop.getProperty(SWP_PASSWORD));
    setSwpServerUrl(prop.getProperty(SWP_SERVER_URL));
    setSwpProduct(prop.getProperty(SWP_PRODUCT));

    ccfMaxWaitTime = Integer.parseInt(prop.getProperty(CCF_MAX_WAIT_TIME));
    ccfRetryInterval = Integer.parseInt(prop
            .getProperty(CCF_RETRY_INTERVAL));

    Service service = Service.create(new URL(getSwpServerUrl()), new QName(
            "http://api2.scrumworks.danube.com/",
            "ScrumWorksAPIBeanService"));
    endpoint = service.getPort(ScrumWorksAPIService.class);
    setUserNameAndPassword("administrator", "password");
}
 
Example 10
Project: jstudy   File: FakeForeignSystemTests.java   View source code 6 votes vote down vote up
private void ifNoDifferentIssuesThenCreate() throws RemoteException, ServiceException, MalformedURLException {

        findDifferentIssues();

        if (fixedIssue == null) {
            fixedIssue = app.soap().addIssue(
                    new Issue()
                            .withProject(project)
                            .withSummary("Fixed issue sample")
                            .withDescription("Пример закрытого(исправленного) баг-репорта")
                            .withResolution(getFixedResolution())
            );
        }

        if (notfixedIssue == null) {
            notfixedIssue = app.soap().addIssue(
                    new Issue()
                            .withProject(project)
                            .withSummary("Notfixed issue sample")
                            .withDescription("Пример открытого(неисправленного) баг-репорта")
                            .withResolution(getNotfixedResolution())
            );
        }

    }
 
Example 11
Project: sfdcCommander   File: SfdcConnectionPool.java   View source code 6 votes vote down vote up
public MetadataBindingStub createMetadataBinding(final SfdcConfig aConfig)
        throws CommanderException {
    PartnerBindingResult partnerBinding = createPartnerBinding(aConfig);
    MetadataServiceLocator metaDataSL = new MetadataServiceLocator();
    SessionHeader sh = new SessionHeader();
    sh.setSessionId(partnerBinding.getLoginResult().getSessionId());

    MetadataBindingStub metaBinding;
    try {
        metaBinding = (MetadataBindingStub) metaDataSL.getMetadata();
        metaBinding._setProperty(SoapBindingStub.ENDPOINT_ADDRESS_PROPERTY,
                partnerBinding.getLoginResult().getMetadataServerUrl());

        metaBinding.setHeader(metaDataSL.getServiceName().getNamespaceURI(),
                "SessionHeader", sh);
    } catch (ServiceException e) {
        throw new CommanderException(
                "Could not instanciate Metadata Connection from Partner connection",
                e);
    }
    return metaBinding;
}
 
Example 12
Project: mzmine2   File: ChemSpiderGateway.java   View source code 6 votes vote down vote up
/**
    * Create a Mass Spec API handle.
    * 
    * @return the newly created handle.
    * @throws IOException
    *             if there were any problems.
    */
   private static MassSpecAPISoap createMassSpecAPI() throws IOException {

LOG.finest("Create mass-spec API handle...");

// Create API handles.
final MassSpecAPISoap handle;
try {
    handle = new MassSpecAPILocator().getMassSpecAPISoap();
} catch (ServiceException e) {
    LOG.log(Level.WARNING,
	    "Problem initializing ChemSpider Mass-Spec API", e);
    throw new IOException("Problem initializing ChemSpider API", e);
}
return handle;
   }
 
Example 13
Project: Telepathology   File: FederationProxy.java   View source code 6 votes vote down vote up
public String getImageInformation(AbstractImagingURN imagingUrn)
throws MalformedURLException, ServiceException, RemoteException, ConnectionException
{
	TransactionContext transactionContext = TransactionContextFactory.get();
	
	logger.info("getImageInformation, Transaction [" + transactionContext.getTransactionId() + "] initiated, image Urn '" + imagingUrn.toString() + "'");
	ImageFederationMetadata imageMetadata = getImageMetadataService();
	
	// if the metadata connection parameters is not null and the metadata connection parameters
	// specifies a user ID then set the UID/PWD parameters as XML parameters, which should
	// end up as a BASIC auth parameter in the HTTP header
	setMetadataCredentials(imageMetadata);
	
	ClassLoader loader = Thread.currentThread().getContextClassLoader();
	Thread.currentThread().setContextClassLoader(ImageXChangeHttpCommonsSender.class.getClassLoader());
	String result = imageMetadata.getImageInformation(imagingUrn.toString(), transactionContext.getTransactionId());
	Thread.currentThread().setContextClassLoader(loader);
	logger.info("getImageInformation, Transaction [" + transactionContext.getTransactionId() + "] returned response of length [" + (result == null ? "null" : result.length()) + "] bytes.");
	return result;
}
 
Example 14
Project: Telepathology   File: FederationProxy.java   View source code 6 votes vote down vote up
public String getImageSystemGlobalNode(AbstractImagingURN imagingUrn)
throws MalformedURLException, ServiceException, RemoteException, ConnectionException
{
	TransactionContext transactionContext = TransactionContextFactory.get();
	
	logger.info("getImageSystemGlobalNode, Transaction [" + transactionContext.getTransactionId() + "] initiated, image Urn '" + imagingUrn.toString() + "'");
	ImageFederationMetadata imageMetadata = getImageMetadataService();
	
	// if the metadata connection parameters is not null and the metadata connection parameters
	// specifies a user ID then set the UID/PWD parameters as XML parameters, which should
	// end up as a BASIC auth parameter in the HTTP header
	setMetadataCredentials(imageMetadata);
	
	ClassLoader loader = Thread.currentThread().getContextClassLoader();
	Thread.currentThread().setContextClassLoader(ImageXChangeHttpCommonsSender.class.getClassLoader());
	String result = imageMetadata.getImageSystemGlobalNode(imagingUrn.toString(), transactionContext.getTransactionId());
	Thread.currentThread().setContextClassLoader(loader);
	logger.info("getImageSystemGlobalNode, Transaction [" + transactionContext.getTransactionId() + "] returned response of length [" + (result == null ? "null" : result.length()) + "] bytes.");
	return result;
}
 
Example 15
Project: Telepathology   File: FederationProxy.java   View source code 6 votes vote down vote up
public String getImageDevFields(AbstractImagingURN imagingUrn, String flags)
throws MalformedURLException, ServiceException, RemoteException, ConnectionException
{
	TransactionContext transactionContext = TransactionContextFactory.get();
	
	logger.info("getImageDevFields, Transaction [" + transactionContext.getTransactionId() + "] initiated, image Urn '" + imagingUrn.toString() + "'");
	ImageFederationMetadata imageMetadata = getImageMetadataService();
	
	// if the metadata connection parameters is not null and the metadata connection parameters
	// specifies a user ID then set the UID/PWD parameters as XML parameters, which should
	// end up as a BASIC auth parameter in the HTTP header
	setMetadataCredentials(imageMetadata);
	
	ClassLoader loader = Thread.currentThread().getContextClassLoader();
	Thread.currentThread().setContextClassLoader(ImageXChangeHttpCommonsSender.class.getClassLoader());
	String result = imageMetadata.getImageDevFields(imagingUrn.toString(), flags, transactionContext.getTransactionId());
	Thread.currentThread().setContextClassLoader(loader);
	logger.info("getImageDevFields, Transaction [" + transactionContext.getTransactionId() + "] returned response of length [" + (result == null ? "null" : result.length()) + "] bytes.");
	return result;
}
 
Example 16
Project: Telepathology   File: FederationProxy.java   View source code 6 votes vote down vote up
public boolean logImageAccessEvent(ImageAccessLogEvent logEvent)
throws MalformedURLException, ServiceException, RemoteException, ConnectionException
{
	TransactionContext transactionContext = TransactionContextFactory.get();
	
	logger.info("logImageAccessEvent, Transaction [" + transactionContext.getTransactionId() + "] initiated, event Type '" + logEvent.getEventType().toString() + "'");
	ImageFederationMetadata imageMetadata = getImageMetadataService();
	
	// if the metadata connection parameters is not null and the metadata connection parameters
	// specifies a user ID then set the UID/PWD parameters as XML parameters, which should
	// end up as a BASIC auth parameter in the HTTP header
	setMetadataCredentials(imageMetadata);
	
	FederationImageAccessLogEventType federationLogEvent = federationTranslator.transformLogEvent(logEvent);
	ClassLoader loader = Thread.currentThread().getContextClassLoader();
	Thread.currentThread().setContextClassLoader(ImageXChangeHttpCommonsSender.class.getClassLoader());
	boolean result = imageMetadata.postImageAccessEvent(transactionContext.getTransactionId(), federationLogEvent);
	Thread.currentThread().setContextClassLoader(loader);
	logger.info("logImageAccessEvent, Transaction [" + transactionContext.getTransactionId() + "] logged image access event " + 
			(result == true ? "ok" : "failed"));
	return result;
	
}
 
Example 17
Project: Telepathology   File: FederationProxy.java   View source code 6 votes vote down vote up
public String[] getPatientSitesVisited(Site site, String patientIcn)
throws MalformedURLException, ServiceException, RemoteException, ConnectionException 
{
	TransactionContext transactionContext = TransactionContextFactory.get();
	
	logger.info("getPatientSitesVisited, Transaction [" + transactionContext.getTransactionId() + "] initiated, patient Icn '" + patientIcn + "' to '" + site.getSiteNumber() + "'.");
	ImageFederationMetadata imageMetadata = getImageMetadataService();
	
	// if the metadata connection parameters is not null and the metadata connection parameters
	// specifies a user ID then set the UID/PWD parameters as XML parameters, which should
	// end up as a BASIC auth parameter in the HTTP header
	setMetadataCredentials(imageMetadata);
	
	ClassLoader loader = Thread.currentThread().getContextClassLoader();
	Thread.currentThread().setContextClassLoader(ImageXChangeHttpCommonsSender.class.getClassLoader());
	String [] sites = imageMetadata.getPatientSitesVisited(patientIcn, transactionContext.getTransactionId(), site.getSiteNumber());
		
	Thread.currentThread().setContextClassLoader(loader);
	
	logger.info("getPatientSitesVisited, Transaction [" + transactionContext.getTransactionId() + "] returned [" + (sites == null ? "null" :  sites.length) + "] sites.");
	return sites;
}
 
Example 18
Project: Telepathology   File: FederationProxy.java   View source code 6 votes vote down vote up
public gov.va.med.imaging.federation.webservices.types.PatientType [] searchPatients(Site site, String searchCriteria)
throws MalformedURLException, ServiceException, RemoteException, ConnectionException
{
	TransactionContext transactionContext = TransactionContextFactory.get();
	
	logger.info("searchPatients, Transaction [" + transactionContext.getTransactionId() + "] initiated, search Criteria '" + searchCriteria + "' to '" + site.getSiteNumber() + "'.");
	ImageFederationMetadata imageMetadata = getImageMetadataService();
	
	// if the metadata connection parameters is not null and the metadata connection parameters
	// specifies a user ID then set the UID/PWD parameters as XML parameters, which should
	// end up as a BASIC auth parameter in the HTTP header
	setMetadataCredentials(imageMetadata);
	
	ClassLoader loader = Thread.currentThread().getContextClassLoader();
	Thread.currentThread().setContextClassLoader(ImageXChangeHttpCommonsSender.class.getClassLoader());
	gov.va.med.imaging.federation.webservices.types.PatientType[] patientsResult = imageMetadata.searchPatients(searchCriteria, transactionContext.getTransactionId(), site.getSiteNumber());	
	Thread.currentThread().setContextClassLoader(loader);
	logger.info("searchPatients, Transaction [" + transactionContext.getTransactionId() + "] returned response of [" + (patientsResult == null ? "null" :  patientsResult.length) + "] patients.");
	return patientsResult;
}
 
Example 19
Project: Telepathology   File: FederationProxyV3.java   View source code 6 votes vote down vote up
private ImageFederationMetadata getImageMetadataService(ProxyServiceType proxyServiceType) 
throws ConnectionException
{
	try
	{
		URL localTestUrl = new URL(proxyServices.getProxyService(proxyServiceType).getConnectionURL());
		gov.va.med.imaging.federation.webservices.soap.v3.ImageMetadataFederationServiceLocator locator = 
			new gov.va.med.imaging.federation.webservices.soap.v3.ImageMetadataFederationServiceLocator();
		ImageFederationMetadata imageMetadata = locator.getImageMetadataFederationV3(localTestUrl);
		((org.apache.axis.client.Stub)imageMetadata).setTimeout(getMetadataTimeoutMs());
		return imageMetadata;
	}
	catch(MalformedURLException murlX)
	{
		logger.error("Error creating URL to access service.", murlX);
		throw new ConnectionException(murlX);
	}
	catch(ServiceException sX)
	{
		logger.error("Service exception." + sX);
		throw new ConnectionException(sX);
	}
}
 
Example 20
Project: Telepathology   File: FederationProxyV2.java   View source code 6 votes vote down vote up
private ImageFederationMetadata getImageMetadataService() 
throws ConnectionException
{
	try
	{
		URL localTestUrl = new URL(proxyServices.getProxyService(ProxyServiceType.metadata).getConnectionURL());
		ImageMetadataFederationServiceLocator locator = new ImageMetadataFederationServiceLocator();
		ImageFederationMetadata imageMetadata = locator.getImageMetadataFederationV2(localTestUrl);
		((org.apache.axis.client.Stub)imageMetadata).setTimeout(getMetadataTimeoutMs());
		return imageMetadata;
	}
	catch(MalformedURLException murlX)
	{
		logger.error("Error creating URL to access service.", murlX);
		throw new ConnectionException(murlX);
	}
	catch(ServiceException sX)
	{
		logger.error("Service exception." + sX);
		throw new ConnectionException(sX);
	}
}
 
Example 21
Project: Telepathology   File: FederationImageDataSourceService.java   View source code 6 votes vote down vote up
@Override
public String getImageInformation(AbstractImagingURN imagingUrn, boolean includeDeletedImages)
throws UnsupportedOperationException, MethodException, ConnectionException, 
	ImageNotFoundException 
{
	getLogger().info("getImageInformation(" + imagingUrn.toString() + "), TransactionContext (" + TransactionContextFactory.get().getDisplayIdentity() + ").");
	try
	{
		String result = getProxy().getImageInformation(imagingUrn);
		getLogger().info("getImageInformation complete.");
		TransactionContextFactory.get().setDataSourceBytesReceived(result == null ? 0L : result.length());
		return result;
	}
	catch(ServiceException sX) {
		getLogger().error("Error getting study image information", sX);
		throw new FederationMethodException(sX);
	}
	catch(IOException ioX) 
	{
		getLogger().error("Error getting study image information", ioX);
		throw new FederationConnectionException(ioX);
	}
}
 
Example 22
Project: Telepathology   File: FederationImageDataSourceService.java   View source code 6 votes vote down vote up
@Override
public String getImageSystemGlobalNode(AbstractImagingURN imagingUrn)
throws UnsupportedOperationException, MethodException, ConnectionException, 
	ImageNotFoundException 
{
	getLogger().info("getImageSystemGlobalNode(" + imagingUrn.toString() + "), TransactionContext (" + TransactionContextFactory.get().getDisplayIdentity() + ").");
	try
	{
		String result = getProxy().getImageSystemGlobalNode(imagingUrn);
		getLogger().info("getImageSystemGlobalNode complete.");
		TransactionContextFactory.get().setDataSourceBytesReceived(result == null ? 0L : result.length());
		return result;
	}
	catch(ServiceException sX) {
		getLogger().error("Error getting image global nodes", sX);
		throw new FederationMethodException(sX);
	}
	catch(IOException ioX) 
	{
		getLogger().error("Error getting image global nodes", ioX);
		throw new FederationConnectionException(ioX);
	}
}
 
Example 23
Project: Telepathology   File: FederationImageDataSourceService.java   View source code 6 votes vote down vote up
@Override
public String getImageDevFields(AbstractImagingURN imagingUrn, String flags)
throws UnsupportedOperationException, MethodException, ConnectionException, 
	ImageNotFoundException 
{
	getLogger().info("getImageDevFields(" + imagingUrn.toString() + "), TransactionContext (" + TransactionContextFactory.get().getDisplayIdentity() + ").");
	try
	{
		String result = getProxy().getImageDevFields(imagingUrn, flags);
		getLogger().info("getImageDevFields complete.");
		TransactionContextFactory.get().setDataSourceBytesReceived(result == null ? 0L : result.length());
		return result;
	}
	catch(ServiceException sX) {
		getLogger().error("Error getting image dev fields", sX);
		throw new FederationMethodException(sX);
	}
	catch(IOException ioX) 
	{
		getLogger().error("Error getting image dev fields", ioX);
		throw new FederationConnectionException(ioX);
	}
}
 
Example 24
Project: Lucee4   File: SoapClient.java   View source code 6 votes vote down vote up
private CacheEntry _get(String cacheName,String method,String key) throws ServiceException, MalformedURLException, RemoteException  {
	Service  service = new Service();
    Call     call    = (Call) service.createCall();
    
    call.registerTypeMapping(
            Element.class, 
            element,
            BeanSerializerFactory.class,
            BeanDeserializerFactory.class);
    
    call.setTargetEndpointAddress( new java.net.URL(endpoint) );
    call.setOperationName(new QName("http://soap.server.ehcache.sf.net/", method));

    call.addParameter("arg0", Constants.XSD_STRING, String.class, ParameterMode.IN);
    call.addParameter("arg1", Constants.XSD_STRING, String.class, ParameterMode.IN);
    call.setReturnClass(Element.class);
    call.setReturnQName(element);
    
    return new SoapCacheEntry((Element) call.invoke( new Object[] {cacheName,key } ));
}
 
Example 25
Project: Lucee4   File: SoapClient.java   View source code 6 votes vote down vote up
private boolean _remove(String cacheName,String method,String key) throws ServiceException, MalformedURLException, RemoteException  {
	Service  service = new Service();
    Call     call    = (Call) service.createCall();
    
    
    call.registerTypeMapping(
            Element.class, 
            element,
            BeanSerializerFactory.class,
            BeanDeserializerFactory.class);
    
    call.setTargetEndpointAddress( new java.net.URL(endpoint) );
    call.setOperationName(new QName("http://soap.server.ehcache.sf.net/", method));

    call.addParameter("arg0", Constants.XSD_STRING, String.class, ParameterMode.IN);
    call.addParameter("arg1", Constants.XSD_STRING, String.class, ParameterMode.IN);
    call.setReturnClass(boolean.class);
    call.setReturnQName(Constants.XSD_BOOLEAN);
  
    return ((Boolean)call.invoke( new Object[] {cacheName,key } )).booleanValue();

}
 
Example 26
Project: Lucee4   File: SoapClient.java   View source code 6 votes vote down vote up
private void _put(String cacheName,String method,Element el) throws ServiceException, MalformedURLException, RemoteException  {
   	Service  service = new Service();
       Call     call    = (Call) service.createCall();
       
       el.setResourceUri(endpoint);
       
       call.registerTypeMapping(
               Element.class, 
               element,
               BeanSerializerFactory.class,
               BeanDeserializerFactory.class);
       
       call.setTargetEndpointAddress( new java.net.URL(endpoint) );
       call.setOperationName(new QName("http://soap.server.ehcache.sf.net/", method));
       
       
       call.addParameter("arg0", Constants.XSD_STRING, String.class, ParameterMode.IN);
       call.addParameter("arg1", element, Element.class, ParameterMode.IN);
       call.setReturnType(Constants.XSD_ANYSIMPLETYPE);
       
       call.invoke( new Object[] {cacheName,el } );
       //call.invokeOneWay(new Object[] {cacheName,el } );
}
 
Example 27
Project: webcurator   File: IndexerBase.java   View source code 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 28
Project: class-guard   File: JaxRpcSupportTests.java   View source code 6 votes vote down vote up
public void testJaxRpcPortProxyFactoryBeanWithDynamicCallsAndLazyLookupAndServiceException() throws Exception {
	JaxRpcPortProxyFactoryBean factory = new JaxRpcPortProxyFactoryBean();
	factory.setServiceFactoryClass(CallMockServiceFactory.class);
	factory.setNamespaceUri("myNamespace");
	factory.setServiceName("myServiceX");
	factory.setPortName("myPort");
	factory.setServiceInterface(IRemoteBean.class);
	factory.setLookupServiceOnStartup(false);
	factory.afterPropertiesSet();

	assertTrue(factory.getObject() instanceof IRemoteBean);
	IRemoteBean proxy = (IRemoteBean) factory.getObject();
	try {
		proxy.setName("exception");
		fail("Should have thrown RemoteException");
	}
	catch (RemoteLookupFailureException ex) {
		// expected
		assertTrue(ex.getCause() instanceof ServiceException);
	}
}
 
Example 29
Project: class-guard   File: JaxRpcSupportTests.java   View source code 6 votes vote down vote up
public void testJaxRpcPortProxyFactoryBeanWithPortInterfaceAndLazyLookupAndServiceException() throws Exception {
	JaxRpcPortProxyFactoryBean factory = new JaxRpcPortProxyFactoryBean();
	factory.setServiceFactoryClass(MockServiceFactory.class);
	factory.setNamespaceUri("myNamespace");
	factory.setServiceName("myServiceX");
	factory.setPortName("myPort");
	factory.setPortInterface(IRemoteBean.class);
	factory.setServiceInterface(IRemoteBean.class);
	factory.setLookupServiceOnStartup(false);
	factory.afterPropertiesSet();

	assertTrue(factory.getObject() instanceof IRemoteBean);
	IRemoteBean proxy = (IRemoteBean) factory.getObject();
	try {
		proxy.setName("exception");
		fail("Should have thrown Service");
	}
	catch (RemoteLookupFailureException ex) {
		// expected
		assertTrue(ex.getCause() instanceof ServiceException);
	}
}
 
Example 30
Project: class-guard   File: JaxRpcSupportTests.java   View source code 6 votes vote down vote up
@Override
public Service loadService(URL url, QName qName, Properties props) throws ServiceException {
	try {
		if (!(new URL("http://myUrl1")).equals(url) || !"".equals(qName.getNamespaceURI()) ||
				!"myService2".equals(qName.getLocalPart())) {
			throw new ServiceException("not supported");
		}
	}
	catch (MalformedURLException ex) {
	}
	if (props == null || !"myValue".equals(props.getProperty("myKey"))) {
		throw new ServiceException("invalid properties");
	}
	serviceCount++;
	return service1;
}
 
Example 31
Project: class-guard   File: ServiceProxy.java   View source code 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 32
Project: apache-tomcat-7.0.57   File: ServiceProxy.java   View source code 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 33
Project: apache-tomcat-7.0.57   File: ServiceProxy.java   View source code 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 34
Project: MetFusion   File: MetlinBean.java   View source code 6 votes vote down vote up
private void setupMetlin(String token) {
	this.locator = new MetlinServiceLocator();
	try {
		this.serv = locator.getMetlinPort();
	} catch (ServiceException e) {
		System.err.println("Error creating MetlinPort for [" + locator.getMetlinPortAddress() + "]");
	}
	
	// retrieve application scoped PropertiesBean
	PropertiesBean pb = (PropertiesBean) FacesContext.getCurrentInstance().getExternalContext().getApplicationMap().get("propertiesBean");
	String propToken = pb.getProperty("metlinToken");		// read security token from properties file
	
	// if another server is not selected and if this property is set, use the designated server rather the default
	if(token.isEmpty() && propToken != null && !propToken.isEmpty())	// use propertyToken if provided token is empty		
		setSecurityToken(propToken);
	else setSecurityToken(token);		// else use provided token
}
 
Example 35
Project: opennmszh   File: RemedyTicketerPlugin.java   View source code 6 votes vote down vote up
/**
 * Convenience method for initializing the ticketServicePort and correctly setting the endpoint.
 *
 * @return TicketServicePort to connect to the remote service.
 */

private HPD_IncidentInterface_WSPortTypePortType getTicketServicePort(String portname, String endpoint) throws PluginException {
    
    HPD_IncidentInterface_WSServiceLocator service = new HPD_IncidentInterface_WSServiceLocator();
    
    HPD_IncidentInterface_WSPortTypePortType port = null;

    try {
       service.setEndpointAddress(portname, endpoint);
       port = service.getHPD_IncidentInterface_WSPortTypeSoap();
    } catch (ServiceException e) {
        log().error("Failed initialzing Remedy TicketServicePort" + e);
        throw new PluginException("Failed initialzing Remedy TicketServicePort", e);
    }
    
    return port;
}
 
Example 36
Project: opennmszh   File: RemedyTicketerPlugin.java   View source code 6 votes vote down vote up
/**
   * Convenience method for initialising the ticketServicePort and correctly setting the endpoint.
   *
   * @return TicketServicePort to connect to the remote service.
   */
  
  private HPD_IncidentInterface_Create_WSPortTypePortType getCreateTicketServicePort(String portname, String endpoint) throws PluginException {
      
HPD_IncidentInterface_Create_WSServiceLocator service = new HPD_IncidentInterface_Create_WSServiceLocator();
      
      HPD_IncidentInterface_Create_WSPortTypePortType port = null;
      
      try {
         service.setEndpointAddress(portname, endpoint);
         port = service.getHPD_IncidentInterface_Create_WSPortTypeSoap();
      } catch (ServiceException e) {
          log().error("Failed initialzing Remedy TicketServicePort" + e);
          throw new PluginException("Failed initialzing Remedy TicketServicePort", e);
      }
      
      return port;
  }
 
Example 37
Project: WBSAirback   File: ServiceProxy.java   View source code 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 38
Project: tomee   File: SeiFactoryImpl.java   View source code 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 39
Project: cagrid-core   File: TerminationClient.java   View source code 6 votes vote down vote up
protected Calendar terminateEntry(EndpointReferenceType entryEPR) throws ServiceException,
    UnableToSetTerminationTimeFaultType, ResourceUnknownFaultType, TerminationTimeChangeRejectedFaultType,
    RemoteException {

    if (LOG.isDebugEnabled()) {
        debugPrintResource("Terminating entry for:", entryEPR);
    }

    WSResourceLifetimeServiceAddressingLocator lifetimeloc = new WSResourceLifetimeServiceAddressingLocator();
    ScheduledResourceTermination lifetimePort = lifetimeloc.getScheduledResourceTerminationPort(entryEPR);
    setSecurityProperties((Stub) lifetimePort);

    SetTerminationTime setTermTimeReq = new SetTerminationTime();
    // terminate now (in 5 seconds)
    Calendar term = Calendar.getInstance();
    term.add(Calendar.SECOND, 5);
    setTermTimeReq.setRequestedTerminationTime(term);
    SetTerminationTimeResponse response = lifetimePort.setTerminationTime(setTermTimeReq);

    LOG.debug("Set to terminate at:" + response.getNewTerminationTime().getTime());
    if (LOG.isDebugEnabled()) {
        debugPrintResource("After terminating entry:", entryEPR);
    }

    return response.getNewTerminationTime();
}
 
Example 40
Project: tomcat7   File: ServiceProxy.java   View source code 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);
    }
}