skip to Main Content

I want to post forms data submitted on a wordpress gravity form to a third party erp software which accepts only soap envelopes. Gravity forms elitle package offers webhooks which has only two formats json and form data, is it possible to post the data as a form. Below is wsdl which i need to map with form fields. If not then what are my options,please help as it is a project to help a friend.

WSDL that i would need to fill:
`

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/" xmlns:v3="http://schemas.datacontract.org/2004/07/V3.WebServiceInterface.Models.V3" xmlns:ser="http://schemas.microsoft.com/2003/10/Serialization/">
   <soapenv:Header/>
   <soapenv:Body>
      <tem:AddJobs>
         <!--Optional:-->
         <tem:jobs>
            <!--Zero or more repetitions:-->
            <v3:Job ser:Id="" ser:Ref="">
               <!--Optional:-->
               <v3:Fields>
                  <!--Zero or more repetitions:-->
                  <v3:Field>
                     <!--Optional:-->
                     <!--type: string-->
                     <v3:Name>My_test_Jalal</v3:Name>
                     <!--Optional:-->
                     <!--type: string-->
                     <v3:Value>verrantque per auras</v3:Value>
                  </v3:Field>
               </v3:Fields>
               <!--Optional:-->
               <!--type: string-->
               <v3:FormName>per auras</v3:FormName>
               <!--Optional:-->
               <v3:Asset ser:Id="circum claustra" ser:Ref="nimborum in">
                  <!--Optional:-->
                  <v3:Fields>
                     <!--Zero or more repetitions:-->
                     <v3:Field>
                        <!--Optional:-->
                        <!--type: string-->
                        <v3:Name>foedere certo</v3:Name>
                        <!--Optional:-->
                        <!--type: string-->
                        <v3:Value>profundum quippe ferant</v3:Value>
                     </v3:Field>
                  </v3:Fields>
                  <!--Optional:-->
                  <!--type: string-->
                  <v3:FormName>et carcere</v3:FormName>
                  <!--Optional:-->
                  <v3:Customer ser:Id="iovis rapidum iaculata" ser:Ref="speluncis abdidit">
                     <!--Optional:-->
                     <v3:Fields>
                        <!--Zero or more repetitions:-->
                        <v3:Field>
                           <!--Optional:-->
                           <!--type: string-->
                           <v3:Name>bella gero et</v3:Name>
                           <!--Optional:-->
                           <!--type: string-->
                           <v3:Value>flammas turbine</v3:Value>
                        </v3:Field>
                     </v3:Fields>
                     <!--Optional:-->
                     <!--type: string-->
                     <v3:FormName>hoc metuens</v3:FormName>
                     <!--Optional:-->
                     <v3:Contacts>
                        <!--Zero or more repetitions:-->
                        <v3:Contact ser:Id="ac vinclis" ser:Ref="speluncis abdidit">
                           <!--Optional:-->
                           <v3:Fields>
                              <!--Zero or more repetitions:-->
                              <v3:Field>
                                 <!--Optional:-->
                                 <!--type: string-->
                                 <v3:Name>aris imponet honorem</v3:Name>
                                 <!--Optional:-->
                                 <!--type: string-->
                                 <v3:Value>praeterea aut</v3:Value>
                              </v3:Field>
                           </v3:Fields>
                           <!--Optional:-->
                           <!--type: string-->
                           <v3:FormName>claustra fremunt</v3:FormName>
                        </v3:Contact>
                     </v3:Contacts>
                     <!--Optional:-->
                     <v3:Products>
                        <!--Zero or more repetitions:-->
                        <v3:Product ser:Id="imperio premit" ser:Ref="quisquam numen">
                           <!--Optional:-->
                           <v3:Fields>
                              <!--Zero or more repetitions:-->
                              <v3:Field>
                                 <!--Optional:-->
                                 <!--type: string-->
                                 <v3:Name>ac vinclis</v3:Name>
                                 <!--Optional:-->
                                 <!--type: string-->
                                 <v3:Value>ac vinclis</v3:Value>
                              </v3:Field>
                           </v3:Fields>
                           <!--Optional:-->
                           <!--type: string-->
                           <v3:FormName>pectore flammas</v3:FormName>
                        </v3:Product>
                     </v3:Products>
                  </v3:Customer>
                  <!--Optional:-->
                  <v3:Products>
                     <!--Zero or more repetitions:-->
                     <v3:Product ser:Id="pectore flammas" ser:Ref="annos bella gero">
                        <!--Optional:-->
                        <v3:Fields>
                           <!--Zero or more repetitions:-->
                           <v3:Field>
                              <!--Optional:-->
                              <!--type: string-->
                              <v3:Name>certo et</v3:Name>
                              <!--Optional:-->
                              <!--type: string-->
                              <v3:Value>rates evertitque aequora</v3:Value>
                           </v3:Field>
                        </v3:Fields>
                        <!--Optional:-->
                        <!--type: string-->
                        <v3:FormName>volutans nimborum in</v3:FormName>
                     </v3:Product>
                  </v3:Products>
               </v3:Asset>
               <!--Optional:-->
               <v3:Contacts>
                  <!--Zero or more repetitions:-->
                  <v3:Contact ser:Id="faciat maria" ser:Ref="et quisquam">
                     <!--Optional:-->
                     <v3:Fields>
                        <!--Zero or more repetitions:-->
                        <v3:Field>
                           <!--Optional:-->
                           <!--type: string-->
                           <v3:Name>et soror</v3:Name>
                           <!--Optional:-->
                           <!--type: string-->
                           <v3:Value>annos bella gero</v3:Value>
                        </v3:Field>
                     </v3:Fields>
                     <!--Optional:-->
                     <!--type: string-->
                     <v3:FormName>ventos tempestatesque sonoras</v3:FormName>
                  </v3:Contact>
               </v3:Contacts>
               <!--Optional:-->
               <v3:Customer ser:Id="regina iovisque" ser:Ref="rapidum iaculata">
                  <!--Optional:-->
                  <v3:Fields>
                     <!--Zero or more repetitions:-->
                     <v3:Field>
                        <!--Optional:-->
                        <!--type: string-->
                        <v3:Name>insuper altos</v3:Name>
                        <!--Optional:-->
                        <!--type: string-->
                        <v3:Value>cum murmure</v3:Value>
                     </v3:Field>
                  </v3:Fields>
                  <!--Optional:-->
                  <!--type: string-->
                  <v3:FormName>in patriam</v3:FormName>
                  <!--Optional:-->
                  <v3:Contacts>
                     <!--Zero or more repetitions:-->
                     <v3:Contact ser:Id="abdidit atris hoc" ser:Ref="coniunx una cum">
                        <!--Optional:-->
                        <v3:Fields>
                           <!--Zero or more repetitions:-->
                           <v3:Field>
                              <!--Optional:-->
                              <!--type: string-->
                              <v3:Name>ipsa iovis</v3:Name>
                              <!--Optional:-->
                              <!--type: string-->
                              <v3:Value>frenat illi indignantes</v3:Value>
                           </v3:Field>
                        </v3:Fields>
                        <!--Optional:-->
                        <!--type: string-->
                        <v3:FormName>nimborum in</v3:FormName>
                     </v3:Contact>
                  </v3:Contacts>
                  <!--Optional:-->
                  <v3:Products>
                     <!--Zero or more repetitions:-->
                     <v3:Product ser:Id="mollitque animos" ser:Ref="montis insuper altos">
                        <!--Optional:-->
                        <v3:Fields>
                           <!--Zero or more repetitions:-->
                           <v3:Field>
                              <!--Optional:-->
                              <!--type: string-->
                              <v3:Name>molemque et montis</v3:Name>
                              <!--Optional:-->
                              <!--type: string-->
                              <v3:Value>gero et</v3:Value>
                           </v3:Field>
                        </v3:Fields>
                        <!--Optional:-->
                        <!--type: string-->
                        <v3:FormName>circum claustra fremunt</v3:FormName>
                     </v3:Product>
                  </v3:Products>
               </v3:Customer>
               <!--Optional:-->
               <v3:ProductRows>
                  <!--Zero or more repetitions:-->
                  <v3:ProductRow ser:Id="montis insuper" ser:Ref="aris imponet">
                     <!--Optional:-->
                     <v3:Fields>
                        <!--Zero or more repetitions:-->
                        <v3:Field>
                           <!--Optional:-->
                           <!--type: string-->
                           <v3:Name>aris imponet</v3:Name>
                           <!--Optional:-->
                           <!--type: string-->
                           <v3:Value>incedo regina</v3:Value>
                        </v3:Field>
                     </v3:Fields>
                     <!--Optional:-->
                     <!--type: string-->
                     <v3:FormName>ac vinclis</v3:FormName>
                  </v3:ProductRow>
               </v3:ProductRows>
               <!--Optional:-->
               <v3:SubJobs/>
            </v3:Job>
         </tem:jobs>
      </tem:AddJobs>
   </soapenv:Body>
</soapenv:Envelope>

`

I am wondering if anyone here has ever tried this before since more than half of internet is running wordpress websites, plus i am pretty knew to wsdl soap. I tried submitting the above soap envelope to the endpoint but it failed so do not know what is wrong in my xml.

2

Answers


  1. You can try to use garivty form action after form submission. You can prepare soap wsdl as per submitted data and send requests using php soapclient library.

    Reference link: https://docs.gravityforms.com/gform_after_submission/

    Thanks!

    Login or Signup to reply.
  2. You can post data by using action hook

    Applies to all forms.

    add_action( 'gform_after_submission', 'after_submission', 10, 2 );
    

    Applies to a specific form. In this case, form id 5.

    add_action( 'gform_after_submission_5', 'after_submission', 10, 2 );
    

    Function to post data to third party

    add_action( 'gform_after_submission', 'post_to_third_party', 10, 2 );
    function post_to_third_party( $entry, $form ) {
    
      $endpoint_url = 'https://thirdparty.com';
      $body = array(
        'first_name' => rgar( $entry, '1.3' ),
        'last_name' => rgar( $entry, '1.6' ),
        'message' => rgar( $entry, '3' ),
        );
      GFCommon::log_debug( 'gform_after_submission: body => ' . print_r( $body, true ) );
    
      $response = wp_remote_post( $endpoint_url, array( 'body' => $body ) );
      GFCommon::log_debug( 'gform_after_submission: response => ' . print_r( $response, true ) );
    

    }

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search