Example #1
0
        private EventStatus QueryImplementation(QueryRequest request)
        {
            runAssertions(request.SIFHeader);

            // Run Query assertions
            if (String.IsNullOrEmpty(request.SIFHeader.TopicName))
            {
                throw new FaultException("No TopicName specified");
            }

            // Verify that the TopicName matches the XML Payload
            QueryType q = request.Query;

            if (!(q.QueryObject.ObjectName == request.SIFHeader.TopicName))
            {
                throw new FaultException("Topic Name does not match name in query XML");
            }

            String[] responseVersion = request.SIFHeader.ResponseVersion;
            if (responseVersion == null || responseVersion.Length < 1)
            {
                throw new FaultException("No Response version specified");
            }

            if (!request.SIFHeader.MaxBufferSizeSpecified)
            {
                throw new FaultException("Max Buffer Size not specified");
            }

            // Special case, throw an error for FoodServiceMilkSales
            {
                if (request.SIFHeader.TopicName == "FoodserviceMilkSales")
                {
                    DataModelErrorType sifError = new DataModelErrorType();
                    sifError.Category     = InfrastructureErrorCategoryType.Item8;
                    sifError.Code         = "4";
                    sifError.Desc         = "Bogus objects are not allowed";
                    sifError.ExtendedDesc = "Please Notify Dave Guidos";
                    throw new FaultException <DataModelErrorType>(sifError, "Planned Exception to test SIF WS Transport");
                }
            }

            return(genericOKResponse());
        }
Example #2
0
        private EventStatus EventImplementation(PostEvent request)
        {
            runAssertions(request.SIFHeader);

            // Run event assertions
            if (!request.SIFHeader.EventActionSpecified)
            {
                throw new FaultException("No EventAction header specified");
            }
            if (String.IsNullOrEmpty(request.SIFHeader.TopicName))
            {
                throw new FaultException("No TopicName specified");
            }

            // Verify that the TopicName matches the XML Payload
            XmlElement eventObject = request.Event;

            if (!(eventObject.Name == request.SIFHeader.TopicName))
            {
                throw new FaultException("Topic Name does not match name in event XML");
            }

            // Special case, throw an error for FoodServiceMilkSales
            {
                if (request.SIFHeader.TopicName == "FoodserviceMilkSales")
                {
                    DataModelErrorType sifError = new DataModelErrorType();
                    sifError.Category     = InfrastructureErrorCategoryType.Item9;
                    sifError.Code         = "3";
                    sifError.Desc         = "Bogus objects are not allowed";
                    sifError.ExtendedDesc = "Please Notify Dave Guidos";
                    throw new FaultException <DataModelErrorType>(sifError, "Planned Exception to test SIF WS Transport");
                }
            }

            return(genericOKResponse());
        }
Example #3
0
        private EventStatus EventImplementation(PostEvent request)
        {
            runAssertions(request.SIFHeader);

            // Run event assertions
            if (!request.SIFHeader.EventActionSpecified)
            {
                throw new FaultException("No EventAction header specified");
            }
            if (String.IsNullOrEmpty(request.SIFHeader.TopicName))
            {
                throw new FaultException("No TopicName specified");
            }

            // Verify that the TopicName matches the XML Payload
            XmlElement eventObject = request.Event;
            if (! (eventObject.Name == request.SIFHeader.TopicName ))
            {
                throw new FaultException("Topic Name does not match name in event XML");
            }

            // Special case, throw an error for FoodServiceMilkSales
            {
                if (request.SIFHeader.TopicName == "FoodserviceMilkSales")
                {
                    DataModelErrorType sifError = new DataModelErrorType();
                    sifError.Category = InfrastructureErrorCategoryType.Item9;
                    sifError.Code = "3";
                    sifError.Desc = "Bogus objects are not allowed";
                    sifError.ExtendedDesc = "Please Notify Dave Guidos";
                    throw new FaultException<DataModelErrorType>(sifError, "Planned Exception to test SIF WS Transport");
                }
            }

            return genericOKResponse();
        }
Example #4
0
        private EventStatus QueryImplementation(QueryRequest request)
        {
            runAssertions(request.SIFHeader);

            // Run Query assertions
            if (String.IsNullOrEmpty(request.SIFHeader.TopicName))
            {
                throw new FaultException("No TopicName specified");
            }

            // Verify that the TopicName matches the XML Payload
            QueryType q = request.Query;
            if (!(q.QueryObject.ObjectName == request.SIFHeader.TopicName))
            {
                throw new FaultException("Topic Name does not match name in query XML");
            }

            String[] responseVersion = request.SIFHeader.ResponseVersion;
            if (responseVersion == null || responseVersion.Length < 1)
            {
                throw new FaultException("No Response version specified");
            }

            if (!request.SIFHeader.MaxBufferSizeSpecified)
            {
                throw new FaultException("Max Buffer Size not specified");
            }

            // Special case, throw an error for FoodServiceMilkSales
            {
                if (request.SIFHeader.TopicName == "FoodserviceMilkSales")
                {
                    DataModelErrorType sifError = new DataModelErrorType();
                    sifError.Category = InfrastructureErrorCategoryType.Item8;
                    sifError.Code = "4";
                    sifError.Desc = "Bogus objects are not allowed";
                    sifError.ExtendedDesc = "Please Notify Dave Guidos";
                    throw new FaultException<DataModelErrorType>(sifError, "Planned Exception to test SIF WS Transport");
                }
            }

            return genericOKResponse();
        }