The GET request is usually used for getting the representation or operation results of the resource. When sending a GET request, it requires to give parameters in the URI. However, different operations on different resources need different parameters. Therefore, it is possible that the URI may be too long because of too many parameters. For example, the response may fail because there are too many measuring points which makes the URI too long. In addition, it is not intuitive to see the parameter structure when assembling request parameters in the URI, and it is easy to make mistakes when the parameter structure is complex.
SuperMap iServer provides the solution to this situation: using POST to GET. The parameters are not placed in the URI, but the request body of the POST request. And then, add "_method= GET" at the end of the URI for the POST request.
Currently, the mechanism is supported by services with interfaces, including rest, restjsr, wms111, wms 130 in iServer. You can determine by specifying the URI of the resource. Taking the geocoding resource in REST service and the GetFeatureInfo operation in the WMS 1.1.1 service as examples, the usage instructions are as follows:
Perform a GET request on the geocoding resource to query the address of a specific company, the request URI is:
http://localhost:8090/iserver/services/addressmatch-BeijingAddress/restjsr/v1/address/geocoding.rjson?address=京东方科技集团股份有限公司&fromIndex=0&toIndex=1&maxReturn=-1
If geocoding resource is assessed using a POST request to simulate a GET request, the request URI is:
http://localhost:8090/iserver/services/addressmatch-BeijingAddress/restjsr/v1/address/geocoding.rjson?_method= GET
And the request body is:
{
"address":"京东方科技集团股份有限公司",
"fromIndex":0,
"toIndex":1,
"maxReturn":-1
}
Perform a GET request on the GetFeatureInfo operation to perform attribute filtering within the specified range, the request URI is:
http://localhost:8090/iserver/services/map-baseline/wms111/guangxi
?REQUEST=GetFeatureInfo&SERVICE=WMS&VERSION=1.1.1&INFO_FORMAT= text/xml &QUERY_LAYERS=0.1
&LAYERS=0.1&WIDTH=256&HEIGHT=256&SRS=EPSG:4326&BBOX=110.12596366179878,22.805670611177316,110.13216922057563,22.810863367830148
&X=15&Y=214&layerDefs={"0.1":"dlmc like '水田'"}&FEATURE_COUNT=2
If GetFeatureInfo operation is assessed using a POST request to simulate a GET request, the request URI is:
http://localhost:8090/iserver/services/map-baseline/wms111/guangxi?_method=GET
And the request body is:
{
"SERVICE":"WMS",
"VERSION": "1.1.1",
"REQUEST": "GetFeatureInfo",
"LAYERS": "0.1",
"QUERY_LAYERS": "0.1",
"SRS": "EPSG:4326",
"BBOX": "110.12596366179878,22.805670611177316,110.13216922057563,22.810863367830148",
"WIDTH": 256,
"HEIGHT": 256,
"FEATURE_COUNT": 2,
"X":15,
"Y":214,
"layerDefs":{
"0.1":"dlmc like '水田'"
}
}