Java 类javax.xml.rpc.ServiceException 实例源码

项目:tomcat7    文件:ServiceProxy.java   
/**
 * @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");
}
项目:lams    文件:ServiceProxy.java   
/**
 * @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");
}
项目:apache-tomcat-7.0.73-with-comment    文件:ServiceProxy.java   
/**
 * @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");
}
项目:core    文件:TrackerWebServicesClient.java   
/**
 * 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();
}
项目:core    文件:TrackerWebServicesClient.java   
/**
 * 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;
}
项目:core    文件:TrackerWebServicesClient.java   
/**
 * 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];
}
项目:core    文件:Connection.java   
/**
 * 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);

}
项目:core    文件:TFSWPAdhocIntegration.java   
/**
 * @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);
    }
}
项目:core    文件:SWPTester.java   
/**
 * 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");
}
项目:jstudy    文件:FakeForeignSystemTests.java   
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())
            );
        }

    }
项目:sfdcCommander    文件:SfdcConnectionPool.java   
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;
}
项目:mzmine2    文件:ChemSpiderGateway.java   
/**
    * 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;
   }
项目:Telepathology    文件:FederationProxy.java   
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;
}
项目:Telepathology    文件:FederationProxy.java   
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;
}
项目:Telepathology    文件:FederationProxy.java   
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;
}
项目:Telepathology    文件:FederationProxy.java   
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;

}
项目:Telepathology    文件:FederationProxy.java   
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;
}
项目:Telepathology    文件:FederationProxy.java   
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;
}
项目:Telepathology    文件:FederationProxyV3.java   
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);
    }
}
项目:Telepathology    文件:FederationProxyV2.java   
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);
    }
}
项目:Telepathology    文件:FederationImageDataSourceService.java   
@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);
    }
}
项目:Telepathology    文件:FederationImageDataSourceService.java   
@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);
    }
}
项目:Telepathology    文件:FederationImageDataSourceService.java   
@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);
    }
}
项目:Lucee4    文件:SoapClient.java   
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 } ));
}
项目:Lucee4    文件:SoapClient.java   
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();

}
项目:Lucee4    文件:SoapClient.java   
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 } );
}
项目:webcurator    文件:IndexerBase.java   
@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);
    }
}
项目:class-guard    文件:JaxRpcSupportTests.java   
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);
    }
}
项目:class-guard    文件:JaxRpcSupportTests.java   
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);
    }
}
项目:class-guard    文件:JaxRpcSupportTests.java   
@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;
}
项目:class-guard    文件:ServiceProxy.java   
/**
 * @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");
}
项目:apache-tomcat-7.0.57    文件:ServiceProxy.java   
/**
 * @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");
}
项目:apache-tomcat-7.0.57    文件:ServiceProxy.java   
/**
 * @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");
}
项目:MetFusion    文件:MetlinBean.java   
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
}
项目:opennmszh    文件:RemedyTicketerPlugin.java   
/**
 * 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;
}
项目:opennmszh    文件:RemedyTicketerPlugin.java   
/**
   * 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;
  }
项目:WBSAirback    文件:ServiceProxy.java   
/**
 * @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");
}
项目:tomee    文件:SeiFactoryImpl.java   
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);
        }
    }
项目:cagrid-core    文件:TerminationClient.java   
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();
}
项目:tomcat7    文件:ServiceProxy.java   
/**
 * 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);
    }
}