本文整理匯總了Java中javax.xml.rpc.ServiceException類的典型用法代碼示例。如果您正苦於以下問題:Java ServiceException類的具體用法?Java ServiceException怎麽用?Java ServiceException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ServiceException類屬於javax.xml.rpc包,在下文中一共展示了ServiceException類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getProxyPortQNameClass
import javax.xml.rpc.ServiceException; //導入依賴的package包/類
/**
* @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");
}
示例2: getProxyPortQNameClass
import javax.xml.rpc.ServiceException; //導入依賴的package包/類
/**
* @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");
}
示例3: getArtifactTypes
import javax.xml.rpc.ServiceException; //導入依賴的package包/類
/**
* 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();
}
示例4: getMetaDataForArtifact
import javax.xml.rpc.ServiceException; //導入依賴的package包/類
/**
* 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;
}
示例5: postAttachment
import javax.xml.rpc.ServiceException; //導入依賴的package包/類
/**
* 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];
}
示例6: Connection
import javax.xml.rpc.ServiceException; //導入依賴的package包/類
/**
* 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);
}
示例7: main
import javax.xml.rpc.ServiceException; //導入依賴的package包/類
/**
* @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);
}
}
示例8: SWPTester
import javax.xml.rpc.ServiceException; //導入依賴的package包/類
/**
* 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");
}
示例9: ifNoDifferentIssuesThenCreate
import javax.xml.rpc.ServiceException; //導入依賴的package包/類
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())
);
}
}
示例10: createMetadataBinding
import javax.xml.rpc.ServiceException; //導入依賴的package包/類
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;
}
示例11: createMassSpecAPI
import javax.xml.rpc.ServiceException; //導入依賴的package包/類
/**
* 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;
}
示例12: getImageInformation
import javax.xml.rpc.ServiceException; //導入依賴的package包/類
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;
}
示例13: getImageSystemGlobalNode
import javax.xml.rpc.ServiceException; //導入依賴的package包/類
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;
}
示例14: getImageDevFields
import javax.xml.rpc.ServiceException; //導入依賴的package包/類
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;
}
示例15: logImageAccessEvent
import javax.xml.rpc.ServiceException; //導入依賴的package包/類
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;
}