use of org.springframework.ws.server.endpoint.annotation.PayloadRoot in project webservices-axiom by apache.
the class BrokerEndpoint method order.
@PayloadRoot(namespace = "urn:broker", localPart = "Order")
@ResponsePayload
@Namespaces(@Namespace(prefix = "p", uri = "urn:broker"))
public OrderStatus order(@XPathParam("/p:Order/p:Customer") Integer customer, @RequestPayload Source payloadSource) throws UnknownCustomerException, TransformerException {
customerService.validateCustomer(customer);
StringWriter sw = new StringWriter();
transformerHelper.transform(payloadSource, new StreamResult(sw));
String payload = sw.toString();
synchronized (orderQueue) {
orderQueue.addLast(payload);
orderQueue.notify();
}
OrderStatus status = new OrderStatus();
status.setReceived(new Date());
return status;
}
use of org.springframework.ws.server.endpoint.annotation.PayloadRoot in project webservices-axiom by apache.
the class CalculatorEndpoint method add.
@PayloadRoot(namespace = NAMESPACE_URI, localPart = "AddRequest")
@ResponsePayload
public Element add(@RequestPayload Element addRequest) throws Exception {
log.debug("Endpoint invoked");
double sum = 0d;
for (Element operand : operandExpression.evaluate(addRequest)) {
sum += Double.parseDouble(operand.getTextNormalize());
}
Element response = new Element("AddResponse", NAMESPACE);
response.setText(String.valueOf(sum));
return response;
}
use of org.springframework.ws.server.endpoint.annotation.PayloadRoot in project spring-boot by spring-projects.
the class HolidayEndpoint method handleHolidayRequest.
@PayloadRoot(namespace = NAMESPACE_URI, localPart = "HolidayRequest")
public void handleHolidayRequest(@RequestPayload Element holidayRequest) throws Exception {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
Date startDate = dateFormat.parse(this.startDateExpression.evaluateFirst(holidayRequest).getText());
Date endDate = dateFormat.parse(this.endDateExpression.evaluateFirst(holidayRequest).getText());
String name = this.nameExpression.evaluateFirst(holidayRequest);
this.humanResourceService.bookHoliday(startDate, endDate, name);
}
use of org.springframework.ws.server.endpoint.annotation.PayloadRoot in project OpenClinica by OpenClinica.
the class StudySubjectEndpoint method listStudySubjectsInStudy.
/**
* Use this method to list all study subjects. Scheduled event data will also be show if available.
*
* @param requestElement
* @return ListAllByStudyResponse
* @throws Exception
*/
@PayloadRoot(localPart = "listAllByStudyRequest", namespace = NAMESPACE_URI_V1)
public ListAllByStudyResponse listStudySubjectsInStudy(JAXBElement<ListStudySubjectsInStudyType> requestElement) throws Exception {
try {
ResourceBundleProvider.updateLocale(new Locale("en_US"));
ListStudySubjectsInStudyType listStudySubjectsInStudyType = requestElement.getValue();
StudyBean study = null;
try {
study = validateRequestAndReturnStudy(listStudySubjectsInStudyType.getStudyRef());
} catch (OpenClinicaSystemException e) {
e.printStackTrace();
ListAllByStudyResponse response = new ListAllByStudyResponse();
response.setResult(messages.getMessage("studySubjectEndpoint.fail", null, "Fail", locale));
response.getError().add(messages.getMessage(e.getErrorCode(), null, e.getErrorCode(), locale));
return response;
}
return mapListStudySubjectsInStudyResponse(study, messages.getMessage("studySubjectEndpoint.success", null, "Success", locale), listStudySubjectsInStudyType.getStudyRef());
} catch (Exception eee) {
eee.printStackTrace();
throw eee;
}
}
use of org.springframework.ws.server.endpoint.annotation.PayloadRoot in project OpenClinica by OpenClinica.
the class CctsSubjectEndpoint method rollBackSubject.
/**
* if NAMESPACE_URI_V1:commitRequest execute this method
* @param gridId
* @param subject
* @param studyOid
* @return
* @throws Exception
*/
@PayloadRoot(localPart = "rollbackRequest", namespace = NAMESPACE_URI_V1)
public Source rollBackSubject(@XPathParam("//s:gridId") String gridId, @XPathParam("//s:subject") NodeList subject, @XPathParam("//s:study/@oid") String studyOid) throws Exception {
Element subjectElement = (Element) (subject.item(0));
SubjectTransferBean subjectTranferBean = unMarshallToSubjectTransfer(gridId, subjectElement, studyOid);
// TODO: Add Logic
return new DOMSource(mapConfirmation(SUCCESS_MESSAGE));
}
Aggregations