use of javax.jws.WebMethod in project ats-framework by Axway.
the class AgentWsImpl method getActionExecutionResults.
/**
* Queue has already finished and the Test Executor is asking for the
* queue execution results.
*
* There is theoretical chance to be called by more than one thread on Test Executor side,
* when more than one queue is started in non-blocking mode. That's why it is synchronized
*
* @param queueName
* @return
* @throws AgentException
*/
@WebMethod
public synchronized byte[] getActionExecutionResults(@WebParam(name = "name") String queueName) throws AgentException {
try {
ByteArrayOutputStream byteOutStream = new ByteArrayOutputStream();
ObjectOutputStream objectOutStream = new ObjectOutputStream(byteOutStream);
objectOutStream.writeObject(QueueExecutionStatistics.getInstance().getActionExecutionResults(queueName));
return byteOutStream.toByteArray();
} catch (Exception e) {
handleExceptions(e);
// always throw but the compiler is not aware of this
return null;
}
}
use of javax.jws.WebMethod in project ats-framework by Axway.
the class AgentWsImpl method getNumberPendingLogEvents.
@WebMethod
public synchronized int getNumberPendingLogEvents() throws AgentException {
final String caller = getCaller();
ThreadsPerCaller.registerThread(caller);
try {
PassiveDbAppender appender = PassiveDbAppender.getCurrentInstance(caller);
if (appender != null) {
return appender.getNumberPendingLogEvents();
}
} finally {
ThreadsPerCaller.unregisterThread();
}
return -1;
}
use of javax.jws.WebMethod in project wildfly by wildfly.
the class JwsWebServiceEndpointVerifier method verifyWebMethod.
void verifyWebMethod(final Method endpointInterfaceDefinedWebMethod) {
final Method endpointImplementationMethod = findEndpointImplMethodMatching(endpointInterfaceDefinedWebMethod);
if (endpointImplementationMethod != null) {
final int methodModifiers = endpointImplementationMethod.getModifiers();
final WebMethod possibleWebMethodAnnotation = endpointImplementationMethod.getAnnotation(WebMethod.class);
if (possibleWebMethodAnnotation == null || !possibleWebMethodAnnotation.exclude()) {
if (Modifier.isPublic(methodModifiers)) {
if (Modifier.isStatic(methodModifiers) || Modifier.isFinal(methodModifiers)) {
verificationFailures.add(new WebMethodIsStaticOrFinal(endpointImplementationMethod));
}
} else {
verificationFailures.add(new WebMethodIsNotPublic(endpointImplementationMethod));
}
}
}
}
use of javax.jws.WebMethod in project bamboobsc by billchen198318.
the class ManualJobServiceImpl method execute.
@WebMethod
@POST
@Path("/executeJob/{uploadOid}")
@Override
public String execute(@WebParam(name = "uploadOid") @PathParam("uploadOid") String uploadOid) throws Exception {
SysExprJobLogVO result = null;
Subject subject = null;
ObjectMapper objectMapper = new ObjectMapper();
String exceptionMessage = "";
try {
Map<String, Object> dataMap = SystemExpressionJobUtils.getDecUploadOid(uploadOid);
if (dataMap == null || StringUtils.isBlank((String) dataMap.get("accountId")) || StringUtils.isBlank((String) dataMap.get("sysExprJobOid"))) {
log.error("no data accountId / sysExprJobOid");
result = new SysExprJobLogVO();
result.setFaultMsg("no data accountId / sysExprJobOid");
return objectMapper.writeValueAsString(result);
}
String accountId = (String) dataMap.get("accountId");
String sysExprJobOid = (String) dataMap.get("sysExprJobOid");
ShiroLoginSupport loginSupport = new ShiroLoginSupport();
subject = loginSupport.forceCreateLoginSubject(accountId);
result = SystemExpressionJobUtils.executeJobForManual(sysExprJobOid);
} catch (ServiceException se) {
se.printStackTrace();
exceptionMessage = se.getMessage().toString();
} catch (Exception e) {
e.printStackTrace();
if (e.getMessage() == null) {
exceptionMessage = e.toString();
} else {
exceptionMessage = e.getMessage().toString();
}
} finally {
if (result == null) {
result = new SysExprJobLogVO();
}
if (subject != null) {
subject.logout();
}
if (!StringUtils.isBlank(exceptionMessage) && StringUtils.isBlank(result.getFaultMsg())) {
result.setFaultMsg(exceptionMessage);
}
}
return objectMapper.writeValueAsString(result);
}
use of javax.jws.WebMethod in project bamboobsc by billchen198318.
the class KpiLogicServiceImpl method findKpis.
/**
* for TEST
* 這是測試 WS REST 用的 metod , 暴露 KPIs 主檔資料
*
* rest address: http://127.0.0.1:8080/gsbsc-web/services/jaxrs/kpis/
*
* json:
* http://127.0.0.1:8080/gsbsc-web/services/jaxrs/kpis/json
*
* xml:
* http://127.0.0.1:8080/gsbsc-web/services/jaxrs/kpis/xml
*
* @param format example: xml / json
* @return
* @throws ServiceException
* @throws Exception
*/
@WebMethod
@GET
@Path("/kpis/{format}")
@Override
public String findKpis(@WebParam(name = "format") @PathParam("format") String format) throws ServiceException, Exception {
List<KpiVO> kpis = null;
try {
kpis = this.kpiService.findListVOByParams(null);
} catch (Exception e) {
e.printStackTrace();
} finally {
if (null == kpis) {
kpis = new ArrayList<KpiVO>();
}
}
if ("json".equals(format)) {
Map<String, Object> paramMap = new HashMap<String, Object>();
paramMap.put("KPIS", kpis);
ObjectMapper mapper = new ObjectMapper();
return mapper.writeValueAsString(paramMap);
}
XStream xstream = new XStream();
//xstream.registerConverter( new DateConverter() );
xstream.setMode(XStream.NO_REFERENCES);
xstream.alias("KPIS", List.class);
xstream.alias("KPI", KpiVO.class);
return "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + xstream.toXML(kpis);
}
Aggregations