I am currently trying to create a webrequest that matches a third party's example. I have found that the ActiveX HTTP object will create a request where addheader will add HTTP headers and addparam will add HTTP(or MIME) parameters. I am not sure if I am missing something in the Chilkat reference materials or not. When I test the request, I get a HTTP 500 error back from the third party's server. The third party's example has Content-Type and Content-Transfer-Encoding on each of its parameters. Also, this could play a role because one of the parameters is a file sent in binary. The rest of the parameters are plain text. The third party also puts the host name in the POST line and adds an additional value to the Content-Disposition element that states the file name being uploaded. I'm not sure how to have Chilkat HTTP to do any of that. I am using Visual FoxPro 9.0 and the ActiveX Chilkat component (The new 9.5.0 single dll).
Here is the request I am sending (values changed to protect data of course) per the Chilkat log:
Here is what the third party is saying a valid example is:
asked Sep 04 '14 at 17:04
If the data in the HttpRequest object is added as parameters (via the HttpRequest.AddParam method), then you'll get what you are currently sending:
... --------------060900060309090107080400 Content-Disposition: form-data; name="Variable1"
If you add the data as "files" to be uploaded, then you'll produce an HTTP request with the additional headers. Instead of calling AddParam, call the AddBytesForUpload2 method for binary data, and AddStringForUpload2 method for text data. These methods allow for you to explicitly specify the content-type.