Getting XML data into the platform

There are a number of ways that you can process XML data without converting it to JSON. This section defines the two key ways in which you can accept an XML payload over HTTP.

HTTP Post with XML as a Body

You can send your XML document as a Body via HTTP Post. To do this your HTTP request must have the following properties:

  • HTTP Request method should be POST

  • Content type of your request should be application/xml

  • Body of your HTTP request should only include your XML content

  • Whole HTTP POST with the header must not be bigger than 10MB, otherwise it will be rejected

There are 2 ways in which you can post your XML using curl. In the first example the XML will be parsed:

curl -X POST -H "Content-Type: application/xml" \
  -d '<foo>Hello XML!</foo>' \
  https://in.platform.address/hooks/your-hook

In this example the use of the raw parameter means that the XML is not processed:

curl -X POST -H "Content-Type: application/xml" \
  -d '<foo>Hello XML!</foo>' \
  https://in.platform.address/hooks/your-hook?raw=true

HTTP Post with XML file as attachment

If you don’t like how XML is parsed and represented as JSON object or if you need to preserve the XML file for further processing, then you can send your XML file in attachment:

  • Method must be POST

  • Content type must be multipart/form-data

  • We highly recommend to have the attached file content type as application/xml

  • The HTTP POST including the header and the attachment must not be bigger than 10MB

In response to this HTTP request WebHook component will upload your file to the platform attachments storage and place a reference it in the generated message as follows:

{
  "id": "2b90def0-d250-11e6-a2f1-6b2841bfd574",
  "attachments": {
    "data.xml" : {
      "url": "http://attachment_storage_URL/files/1cfc3a71-d7a7-44e6-a15e-ae18860d537c",
      "content-type": "application/xml"
    }
  },
  "body": {
  },
  "headers": {
    "x-real-ip": "10.0.5.31, 10.0.5.31",
    "host": "in.platform.address",
    "x-forwarded-for": "10.0.5.31",
    "x-nginx-proxy": "true",
    "x-forwarded-proto": "https",
    "connection": "upgrade",
    "content-length": "21",
    "user-agent": "curl/7.51.0",
    "accept": "*/*",
    "content-type": "application/xml"
  }
}

The platform will not parse your XML file and it will be temporarily stored and accessible to later steps in the integration flow which will pick up and process the file as required.

Reading XML files from external location

You can read XML files from an external location such as a URI or FTP.