Forms: 3rd-Party Xml Post
Contributors: zaus, leadlogic
Donate link: http://drzaus.com/donate
Tags: contact form, form, contact form 7, CF7, gravity forms, GF, CRM, mapping, 3rd-party service, services, remote request, xml, json, soap, xml webservice, soap webservice, json webservice, nested fields, xpost
Requires at least: 3.0
Tested up to: 4.1
Stable tag: trunk
License: GPLv2 or later
Converts submission from Forms 3rdparty Integration to xml/json, add headers, or nest fields.
Converts external submission from Forms: 3rdparty Integration plugin to XML or JSON post; optionally can add custom headers (to allow SOAP submissions) or transform/combine separate fields into nested values.
This plugin will turn the 3rdparty mappings into XML elements, so that each form post will be the value (or attribute) of an XML element.
- Unzip, upload plugin folder to your plugins directory (
- Make sure Contact Form 7 or Gravity Forms is installed
- Make sure Forms: 3rdparty Integration is installed
- Activate plugin
- Go to new admin subpage "3rdparty Services" under the CF7 "Contact" menu or Gravity Forms "Forms" menu and configure services + field mapping.
- Configure the new "Xml Post" section to choose which services send as xml and/or determine special headers (given as a url querystring).
- Nest fields by separating nodes with
/, and indicate attributes with
Frequently Asked Questions
I need help
Submit an issue to the GitHub issue tracker in addition to / instead of the WP Support Forums.
How do I add / configure a service?
See "base plugin" Forms: 3rdparty Integration.
How do I set headers
Provide the list of headers as though they were a URL querystring, so that
Content-Type: something X-Special-Header: something-else
would be given as
You may also use shortcodes such as
base64 in the header.
How do I nest elements?
Separate element names within the same 3rdparty field mapping using
/, so that in order to make:
<credentials type="123"> <user>xyz</user> <pass>abc</pass> </credentials>
you would use
Note: You may nest and wrap elements even if not transforming into XML; they will be submitted as multi-dimensional arrays like:
How do I set xml prolog attributes?
Just enter the entire root xml in the field, a la http://stackoverflow.com/questions/5992268/simplexml-how-to-correctly-set-encoding-and-xmins
How do I autoclose/not autoclose empty values?
<SomeTag />, make sure the "Autoclose" option is enabled.
<SomeTag></SomeTag>, make sure the "Autoclose" option is unchecked.
How do I completely customize the xml/wrappers/transform?
Use the 'Mask' format, which allows you to specify the result exactly as you want via string replacement. Useful for complex XML.
The 'Root Element' field will now be treated as a string-replacement mask (a la
sprintf), so make sure to include the post body with the
Each '3rd-Party Field' will also be treated the same, using
%s to indicate where the submission value should go.
- ignores xml root when considering escaped backslashes (compatibility break -- please update your setting accordingly)
- 'mask' format -- greater flexibility and control over field/wrapper
- shortcodes in header; base64 shortcode
- autoclose option
- decided it was good enough to be v1
multipart/form-dataand 'url' formatting per GitHub issue #6 https://github.com/zaus/forms-3rdparty-xpost/issues/6
- Added xml prolog/root workaround per GitHub issue #8 https://github.com/zaus/forms-3rdparty-xpost/issues/8
- Can now enter actual xml as root element for finer customization
Can post body as json instead
Fixed GitHub issue #3 https://github.com/zaus/forms-3rdparty-xpost/issues/3:
- each plugin setting is only applied to that specific service if it has a value
- removed default
postwrapper unless sending as xml (and if you send XML you should specify a wrapper)
Can nest regular post fields even when not submitting XML.
- Element nesting, attributes
- reworked "xmlify" using recursive
Base version - xml and header transformation
- no longer requires that you escape backslashes in the wrapper if providing XML (i.e. it starts with <) -- breaks backwards compatibility