use of javax.jws.WebMethod in project camel by apache.
the class SoapJaxbDataFormat method marshal.
/**
* Marshal inputObjects to SOAP xml. If the exchange or message has an
* EXCEPTION_CAUGTH property or header then instead of the object the
* exception is marshaled.
*
* To determine the name of the top level xml elements the elementNameStrategy
* is used.
* @throws IOException,SAXException
*/
public void marshal(Exchange exchange, Object inputObject, OutputStream stream) throws IOException, SAXException {
checkElementNameStrategy(exchange);
String soapAction = getSoapActionFromExchange(exchange);
if (soapAction == null && inputObject instanceof BeanInvocation) {
BeanInvocation beanInvocation = (BeanInvocation) inputObject;
WebMethod webMethod = beanInvocation.getMethod().getAnnotation(WebMethod.class);
if (webMethod != null && webMethod.action() != null) {
soapAction = webMethod.action();
}
}
Object envelope = adapter.doMarshal(exchange, inputObject, stream, soapAction);
// and continue in super
super.marshal(exchange, envelope, stream);
}
use of javax.jws.WebMethod in project camel by apache.
the class ServiceInterfaceStrategy method analyzeMethod.
/**
* Determines how the parameter object of the service method will be named
* in xml. It will use either the RequestWrapper annotation of the method if
* present or the WebParam method of the parameter.
*
* @param method
*/
private MethodInfo analyzeMethod(Method method) {
List<TypeInfo> inInfos = getInInfo(method);
TypeInfo outInfo = getOutInfo(method);
WebMethod webMethod = method.getAnnotation(WebMethod.class);
String soapAction = (webMethod != null) ? webMethod.action() : null;
return new MethodInfo(method.getName(), soapAction, inInfos.toArray(new TypeInfo[inInfos.size()]), outInfo);
}
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);
}
use of javax.jws.WebMethod in project opentheso by miledrousset.
the class Soap method conceptToSkos.
/**
* Web service operation
* @param idConcept
* @param idThesaurus
* @return
*/
@WebMethod(operationName = "conceptToSkos")
public String conceptToSkos(@WebParam(name = "idConcept") String idConcept, @WebParam(name = "idThesaurus") String idThesaurus) {
if (ds == null)
return null;
if (prefs == null)
return null;
ExportFromBDD exportFromBDD = new ExportFromBDD();
exportFromBDD.setServerArk(prefs.getProperty("serverArk"));
exportFromBDD.setServerAdress(prefs.getProperty("cheminSite"));
String skos = exportFromBDD.exportConcept(ds, idThesaurus, idConcept).toString();
return skos;
}
Aggregations