How to post data to WCF service from Jotform

  • jessy_l
    Asked on April 26, 2016 at 1:42 PM

    Hi,

    I have created a WCF Service and want to consume that in the Jot form.

    The requirement would be post data from Jot Form to WCF Service.

    The service thereby will send the data to a Web API. I tested the WCF Service and am able to post data to the API.

    WCF service accepts the input type to be either XML/JSON.

    In order to consume the WCF, I tried out the following,

    This is the test form I created using Jotform with few fields

    https://form.jotform.com/61162877095160

    Set the Send Post Data in Advanced Settings of Preference to 'Yes'

    I am new to php, wrote PHP code to call the method in the service and passed the data

    http://pastiebin.com/571f578199e01

    I have put the above Url in the Webhook integration.

    Send Post Data - Posts HTTP data to the thank you page.

    How do I pass the form data to this WCF service, is it through the webhook or through the thank you page redirection.

     

    Can I have simple example which does this kind of flow.

     

    I found codes lines explaining how data is posted to another JOT form or an html page.

    But could find less information on detailed steps.

  • Charlie
    Replied on April 26, 2016 at 3:08 PM

    There actually two ways on how you can send data via POST method.

    Method 1: You can setup a PHP script and add it as your "Thank You" page, you need to enable the "Send POST Data" option in your preferences for this. In this case, you are simply passing the data on your target "Thank You" page which is a PHP script.

    For method 1, you can check the following guides:

    Send POST Data via your "Thank You" page: https://www.jotform.com/help/213-Send-POST-Data-From-JotForm-Using-PHP-in-Custom-Thank-You-Page 

     

     

    Method 2: If you do not want the PHP script to be in the landing page, you can simply add it in the Webhook integration, it does the same with the "Thank You" page, but in this case, the PHP script runs when the form is submitted and the user does not need to be redirected on that page.

    Here's a guide that will help you on how to setup send POST Data via Webhook: https://www.jotform.com/help/245-How-to-Setup-Webhook-with-JotForm 

     

    If you want to know the exact PHP variables for your form, then you can follow the steps in this guide: https://www.jotform.com/help/51-How-to-Post-Submission-Data-to-Thank-You-Page. You can simply see the PHP code variables you need to call in your PHP script to get the submission data.

    Now your target PHP script should be connected to WCF, I presume you already have your API? You can simply get the variables then pass it to your WCF using your API.

     

    Here's a sample cloned form that I have: https://form.jotform.com/61165704478965.

    My landing page is this PHP script: https://shots.jotform.com/charlie/send-post-data.php 

    You can view my PHP code here: https://github.com/LightDev777/JotForm-Scripts/blob/master/PHP-Sample-Script.php

    If you make a test submission on my form, you see that I simply echoed or printed the data on the page AND I have a Javascript that will show a pop-up message showing the submission ID. Those are simple scripts and you will be able to use the data however you like, you can pass it to another database, use an API on it, etc...

     

    I hope that helps.