public DeliverANPRTrafficDataResponse GetDeliverAnprTrafficDataResponse(DeliverANPRTrafficDataRequest deliverANPRTrafficDataRequest) { log.Info("New DeliverANPRTrafficDataRequest received."); D2LogicalModel d2LogicalModel = deliverANPRTrafficDataRequest.D2LogicalModel; JourneyTimePublication journeyTimePublication = null; // Validate the D2Logical Model if (!ExampleDataCheckOk(d2LogicalModel)) { throw new SoapException("Incoming reqest does not appear to be valid!", SoapException.ClientFaultCode); } // JourneyTimePublication contains on or more journey times. try { journeyTimePublication = (JourneyTimePublication) d2LogicalModel.payloadPublication; if (journeyTimePublication != null && journeyTimePublication.journeyTimes[0] != null) { // You could use the JourneyTimePublication and extract the // corresponding fields. log.Debug("JourneyTime: Timestampis " + journeyTimePublication.journeyTimes[0].timeStamp.ToString()); } } catch (Exception e) { log.Debug("Error while obtaining JourneyTimePublication."); log.Error(e.Message); throw new SoapException("Error while obtaining JourneyTimePublication.", SoapException.ServerFaultCode, e); } DeliverANPRTrafficDataResponse response = new DeliverANPRTrafficDataResponse(); response.status = "DeliverANPRTrafficDataResponse: Successful Delivery"; return response; }
public void CheckErrorInDeliverANPRTrafficDataTest() { IAnprTrafficDataService anprTrafficDataService = new AnprTrafficDataService(); DeliverANPRTrafficDataRequest deliverANPRTrafficDataRequest = new DeliverANPRTrafficDataRequest(); model = null; // This will be checked by ExampleDataCheckOk(d2LogicalModel) deliverANPRTrafficDataRequest.D2LogicalModel = model; string expected = "DeliverANPRTrafficDataResponse: Successful Delivery"; string actual; // This should cause a SoapException actual = (anprTrafficDataService.GetDeliverAnprTrafficDataResponse(deliverANPRTrafficDataRequest)).status; Assert.AreEqual(expected, actual); }
public void CheckValidGetDeliverAnprTrafficDataResponseTest() { IAnprTrafficDataService anprTrafficDataService = new AnprTrafficDataService(); DeliverANPRTrafficDataRequest deliverANPRTrafficDataRequest = new DeliverANPRTrafficDataRequest(); deliverANPRTrafficDataRequest.D2LogicalModel = model; string expected = "DeliverANPRTrafficDataResponse: Successful Delivery"; string actual; actual = (anprTrafficDataService.GetDeliverAnprTrafficDataResponse(deliverANPRTrafficDataRequest)).status; Assert.AreEqual(expected, actual); }