コード例 #1
0
 /**
  * receive a request of a registerSensor request and returns the corresponding response
  *
  * @param request registerSensor request
  * @return Returns RegisterSensorResponse or ExceptionReport, if registering of sensor failed
  */
 public ISosResponse receiveRequest(AbstractSosRequest request) {
   ISosResponse response = null;
   SosRegisterSensorRequest regSensorRequest = (SosRegisterSensorRequest) request;
   try {
     String assignedSensorId = this.dao.insertSensor(regSensorRequest);
     response =
         new RegisterSensorResponse(
             SosConfigurator.getInstance()
                 .getResponseEncoder()
                 .createRegisterSensorResponse(assignedSensorId));
   } catch (OwsExceptionReport owse) {
     return new ExceptionResp(owse.getDocument());
   }
   return response;
 }
コード例 #2
0
ファイル: AbstractSoapEncoder.java プロジェクト: ydamigos/SOS
 /**
  * Creates a SOAPFault element from SOS exception
  *
  * @param soapFault SOAPFault element
  * @param owsExceptionReport SOS exception
  * @return SOAP action URI.
  * @throws SOAPException if an error occurs.
  */
 protected String createSOAPFaultFromExceptionResponse(
     SOAPFault soapFault, OwsExceptionReport owsExceptionReport) throws SOAPException {
   // FIXME: check and fix support for ExceptionReport with multiple
   // exceptions!
   if (!owsExceptionReport.getExceptions().isEmpty()) {
     CodedException firstException = owsExceptionReport.getExceptions().iterator().next();
     if (soapFault.getNamespaceURI().equalsIgnoreCase(SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE)) {
       QName qname = new QName(soapFault.getNamespaceURI(), "Client", soapFault.getPrefix());
       soapFault.setFaultCode(qname);
     } else {
       soapFault.setFaultCode(SOAPConstants.SOAP_SENDER_FAULT);
       if (firstException.getCode() != null) {
         soapFault.appendFaultSubcode(
             new QName(
                 OWSConstants.NS_OWS,
                 firstException.getCode().toString(),
                 OWSConstants.NS_OWS_PREFIX));
       } else {
         soapFault.appendFaultSubcode(OWSConstants.QN_NO_APPLICABLE_CODE);
       }
     }
     soapFault.addFaultReasonText(
         SoapHelper.getSoapFaultReasonText(firstException.getCode()), Locale.ENGLISH);
     Detail detail = soapFault.addDetail();
     for (CodedException exception : owsExceptionReport.getExceptions()) {
       createSOAPFaultDetail(detail, exception);
     }
     return getExceptionActionURI(firstException.getCode());
   } else {
     SoapFault fault = new SoapFault();
     fault.setFaultCode(SOAPConstants.SOAP_RECEIVER_FAULT);
     fault.setFaultSubcode(OWSConstants.QN_NO_APPLICABLE_CODE);
     fault.setFaultReason(DEFAULT_FAULT_REASON);
     fault.setLocale(Locale.ENGLISH);
     fault.setDetailText(MISSING_EXCEPTION_DETAIL_TEXT);
     createSOAPFault(soapFault, fault);
     return SosSoapConstants.RESP_ACTION_SOS;
   }
 }
コード例 #3
0
 @ResponseBody
 @ExceptionHandler(OwsExceptionReport.class)
 @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
 public String error(final OwsExceptionReport e) {
   return e.getMessage();
 }