login about faq


I have to get data from a webservice (described as "like REST") , the site needs a certificate. We send some data in XML form but as contenttype text/plain (dont ask:-) ) and receive some data in XML form.

We have different certificates on the pc, so the one to be used comes from a file (see down)

In the next lines there is code from our working c# solution. But now need to do implement it in another project in VFP and want to use chilkat for it (which we use for ftp,..)

Can you give me a hint where to start or some code ?

Thanks a lot in advance tom

Here is the main part of the c# program :

namespace WebClientService

{ public class WebClient

    private readonly ILog _log;
    public WebClient()

    public string SendData(string uri, String xmlData)

        var url = new Uri(uri);
        SecureWebClient client = new SecureWebClient();

       var response =client.UploadString(url, xmlData);


        return response.ToString();


    class SecureWebClient : System.Net.WebClient

        protected override WebRequest GetWebRequest(Uri address)
            HttpWebRequest request = (HttpWebRequest)base.GetWebRequest(address);

            ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
            //ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
            X509Certificate myCert =  X509Certificate2.CreateFromCertFile("ClientCertificate.cer");
            return request;



asked Mar 21 at 06:58

tomkn's gravatar image


Hi Tom,

You could start with this example "https://www.example-code.com/foxpro/http_public_key_pinning.asp", where you make a secure connection with server getting public key.

In your case you could use this "https://www.chilkatsoft.com/refdoc/xPublicKeyRef.html" to get public key from your certificate and use in the example above.

Once connected you could use "https://www.example-code.com/foxpro/rest_simple.asp" to use REST.

Hope this could help you as start.



answered May 17 at 17:55

Sibuya's gravatar image


Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: Mar 21 at 06:58

Seen: 362 times

Last updated: May 17 at 17:55

powered by OSQA