Archived Forum Post

Index of archived forum posts

Question:

server keeps returning 404 not found

Oct 09 '16 at 18:21

Chilkat Mono 9.5.0.59 on Mac and Windows, I am sending a post request to this address: http://wms.qgiscloud.com/guillaume_av/tetst1?

POST param:

<wfs:Transaction version="1.0.0" service="WFS" xmlns:ows="http://www.opengis.net/ows" xmlns:wfs="http://www.opengis.net/wfs" xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
  <wfs:Update typeName="line">
    <wfs:Property>
      <wfs:Name>geometry</wfs:Name>
      <wfs:Value>
        <gml:MultiLineString srsName="EPSG:4326">
          <gml:lineStringMember>
            <gml:LineString srsName="EPSG:4326">
              <gml:coordinates decimal="." cs="," ts="">
174.843693560235,-36.8547055765507 174.861438815943,-36.8489412142292
</gml:coordinates>
            </gml:LineString>
          </gml:lineStringMember>
        </gml:MultiLineString>
      </wfs:Value>
    </wfs:Property>
    <ogc:Filter>
      <ogc:FeatureId gml:id="line.46" />
    </ogc:Filter>
  </wfs:Update>
</wfs:Transaction>

My code:

Http httP = new Http();
http.PreferIpv6 = true;
if(credentials != null)
{
http.Login = credentials.UserName;
http.Password = credentials.Password;
http.BasicAuth = true;
}
http.UseBgThread = true;
http.PBinary("POST", Url, Encoding.UTF8.GetBytes(parameters), "application/xml", false, false);

It succeeds in my browser but returns the following eror with chilkat:

ChilkatLog:
  PBinary:
    DllDate: Sep 18 2016
    ChilkatVersion: 9.5.0.59
    UnlockPrefix: *******
    Architecture: Little Endian; 64-bit
    Language: MAC OS X C/C++
    VerboseLogging: 1
    binaryRequest:
      fullRequest:
        a_synchronousRequest:
          generateRequestHeader:
            httpRequestGenStartLine:
              genStartLine:
                startLine: POST /guillaume_av/tetst1 HTTP/1.1
              --genStartLine
            --httpRequestGenStartLine
            addCookies:
              Not auto-adding cookies.
              sendCookies: 1
              cookieDir: 
            --addCookies
            Adding Basic Authentication Header
            login: guillaume
          --generateRequestHeader
          fullHttpRequest:
            domain: wms.qgiscloud.com
            port: 80
            ssl: 0
            openHttpConnection:
              Opening connection directly to HTTP server.
              httpHostname: wms.qgiscloud.com
              httpPort: 80
              ssl: 0
              HTTP connection succeeded.
            --openHttpConnection
            connectTime: Elapsed time: 393 millisec
            sendRequestHeader:
              sendHeaderElapsedMs: 1
            --sendRequestHeader
            sendRequestBody:
              sendBodyElapsedMs: 0
            --sendRequestBody
            statusCode: 404
            statusText: Not Found
            checkUngzipResponse:
              decompressing GZIP response...
            --checkUngzipResponse
          --fullHttpRequest
          success: 1
        --a_synchronousRequest
        success: 1
      --fullRequest
      responseStatus: 404
      Failed.
    --binaryRequest
    Failed.
  --PBinary
  urlObject_loadUrl:
  --urlObject_loadUrl
--ChilkatLog

Any help appreciated Guillaume


Accepted Answer

This URL: http://wms.qgiscloud.com/guillaume_av/tetst1? is a bit strange because it has a "?" at the very end, but with no query parameters.

If I copy-and-paste just that URL into a browser, I get an error (but not a 404 not found). I know it's a GET and not a POST when I do that, but I'm just experimenting..

If I remove the "?" from the end of the URL, and paste "http://wms.qgiscloud.com/guillaume_av/tetst1", then I get a 404 not found. But this is a URL where the final part in the path is assumed to be a file (not a directory).

If instead add a "/", and paste "http://wms.qgiscloud.com/guillaume_av/tetst1/" in a browser, then this returns the same as for "http://wms.qgiscloud.com/guillaume_av/tetst1?".

Chilkat is likely discarding the "?" because there are no query params. Instead, use "http://wms.qgiscloud.com/guillaume_av/tetst1/". See if that solves the problem.