MCPcopy Index your code
hub / github.com/MapServer/MapServer / msWFSException

Function msWFSException

mapwfs.c:52–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50*/
51
52int msWFSException(mapObj *map, const char *locator, const char *code,
53 const char *version )
54{
55 const char *encoding;
56 char *schemalocation = NULL;
57 /* In WFS, exceptions are always XML.
58 */
59
60 if( version == NULL )
61 version = "1.1.0";
62
63 if( msOWSParseVersionString(version) >= OWS_1_1_0 )
64 return msWFSException11( map, locator, code, version );
65
66 encoding = msOWSLookupMetadata(&(map->web.metadata), "FO", "encoding");
67 if (encoding)
68 msIO_printf("Content-type: text/xml; charset=%s%c%c", encoding,10,10);
69 else
70 msIO_printf("Content-type: text/xml%c%c",10,10);
71
72 msOWSPrintEncodeMetadata(stdout, &(map->web.metadata), "FO", "encoding", OWS_NOERR,
73 "<?xml version='1.0' encoding=\"%s\" ?>\n", "ISO-8859-1");
74
75 msIO_printf("<ServiceExceptionReport ");
76 msIO_printf("version=\"1.2.0\" ");
77 msIO_printf("xmlns=\"http://www.opengis.net/ogc\" ");
78 msIO_printf("xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" ");
79 schemalocation = msEncodeHTMLEntities(msOWSGetSchemasLocation(map));
80 msIO_printf("xsi:schemaLocation=\"http://www.opengis.net/ogc %s/wfs/1.0.0/OGC-exception.xsd\">\n", schemalocation);
81 free(schemalocation);
82 msIO_printf(" <ServiceException code=\"%s\" locator=\"%s\">\n", code, locator);
83 /* Optional <Locator> element currently unused. */
84 /* msIO_printf(" <Message>\n"); */
85 msWriteErrorXML(stdout);
86 /* msIO_printf(" </Message>\n"); */
87 msIO_printf(" </ServiceException>\n");
88 msIO_printf("</ServiceExceptionReport>\n");
89
90 return MS_FAILURE; /* so we can call 'return msWFSException();' anywhere */
91}
92
93/*
94** Helper function to build a list of output formats.

Callers 6

msWFSException11Function · 0.85
msWFSGetCapabilitiesFunction · 0.85
msWFSDescribeFeatureTypeFunction · 0.85
msWFSGetFeatureFunction · 0.85
msWFSDispatchFunction · 0.85

Calls 8

msOWSParseVersionStringFunction · 0.85
msWFSException11Function · 0.85
msOWSLookupMetadataFunction · 0.85
msIO_printfFunction · 0.85
msOWSPrintEncodeMetadataFunction · 0.85
msEncodeHTMLEntitiesFunction · 0.85
msOWSGetSchemasLocationFunction · 0.85
msWriteErrorXMLFunction · 0.85

Tested by

no test coverage detected