<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Sending raw XML payload in Workato Pros Discussion Board</title>
    <link>https://systematic.workato.com/t5/workato-pros-discussion-board/sending-raw-xml-payload/m-p/11607#M4460</link>
    <description>&lt;P&gt;yes, there is a simpler and correct way, but it requires bypassing Workato’s XML/JSON formatters entirely and sending the payload as a raw HTTP body, not as a structured request.&amp;nbsp;request_format_xml and request_format_raw are mutually exclusive with “send this string as-is”.&amp;nbsp;If Workato is serializing anything for you, it will always modify the payload.&lt;BR /&gt;&lt;BR /&gt;Do not use any request formatter and set the request body directly as a string:&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;xml_body = &amp;lt;&amp;lt;XML&amp;lt;?xml version="1.0"?&amp;gt;&amp;lt;!DOCTYPE cXML SYSTEM &lt;A href="http://xml.cxml.org/schemas/cXML/1.2.035/InvoiceDetail.dtd" target="_blank"&gt;http://xml.cxml.org/schemas/cXML/1.2.035/InvoiceDetail.dtd&lt;/A&gt;"&amp;gt;.......&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;post('receiveInbCXML')&lt;/STRONG&gt;&lt;STRONG&gt;.headers(&lt;/STRONG&gt;&lt;STRONG&gt;'Content-Type': 'application/xml'&lt;/STRONG&gt;&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;STRONG&gt;.body(xml_body)&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;This is the only way to forward cXML “as-is” in Workato.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 20 Jan 2026 16:32:11 GMT</pubDate>
    <dc:creator>francbaviello</dc:creator>
    <dc:date>2026-01-20T16:32:11Z</dc:date>
    <item>
      <title>Sending raw XML payload</title>
      <link>https://systematic.workato.com/t5/workato-pros-discussion-board/sending-raw-xml-payload/m-p/11606#M4459</link>
      <description>&lt;P&gt;I’m trying to send a raw request using the connector SDK. I have a string containing a cXML payload that Workato needs to forward as-is to an API endpoint. Here is an example snippet of the payload:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;?xml version="1.0"?&amp;gt;
&amp;lt;!DOCTYPE cXML SYSTEM "http://xml.cxml.org/schemas/cXML/1.2.035/InvoiceDetail.dtd"&amp;gt;
&amp;lt;cXML payloadID="1234" timestamp="2026-01-20T00:00:00+01:00" version="1.2.024" xml:lang="NL"&amp;gt;
    &amp;lt;Header&amp;gt;
        ...
    &amp;lt;/Header&amp;gt;
    &amp;lt;Request Id="cXMLData" deploymentMode="production"&amp;gt;
        ...
    &amp;lt;/Request&amp;gt;
&amp;lt;/cXML&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;However, the .format_xml method requires a root XML element, which already exists in the input string. Additionally, the input includes the XML declaration and DOCTYPE, neither of which are supported by .format_xml. The method also requires the payload to be converted to JSON first.&lt;/P&gt;&lt;P&gt;As a result, I’m forced to transform the XML to JSON and then back to XML, which isn't ideal:&lt;/P&gt;&lt;LI-CODE lang="ruby"&gt;# Remove XML declaration and DOCTYPE using regex
        xml_body = xml_body.gsub(/\A&amp;lt;\?xml.*?\?&amp;gt;\s*/m, '')          # remove &amp;lt;?xml ... ?&amp;gt;
        xml_body = xml_body.gsub(/&amp;lt;!DOCTYPE.*?&amp;gt;\s*/m, '')            # remove &amp;lt;!DOCTYPE ... ?&amp;gt;

        # Parse XML into a hash
        parsed_xml = xml_body.from_xml
        parsed_xml = call(:replace_ampersands, call(:rename_lang_keys, parsed_xml)) # rename @lang to @xml:lang

        parsed_xml = {
          '@payloadID': parsed_xml['cXML'][0]['@payloadID'],
          '@timestamp': parsed_xml['cXML'][0]['@timestamp'],
          '@version': parsed_xml['cXML'][0]['@version'],
          '@xml:lang': parsed_xml['cXML'][0]['@xml:lang'],
          Header: parsed_xml['cXML'][0]['Header'],
          Request: parsed_xml['cXML'][0]['Request']
        }

        response = post('receiveInbCXML', parsed_xml)
        .request_format_xml('cXML')
        .response_format_xml()&lt;/LI-CODE&gt;&lt;P&gt;I’ve also tried using request_format_raw, but it wraps the payload in string quotation marks, which the API endpoint does not accept.&lt;/P&gt;&lt;P&gt;Is there a simpler way to send a raw message to the API endpoint without modifying the payload?&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jan 2026 09:22:50 GMT</pubDate>
      <guid>https://systematic.workato.com/t5/workato-pros-discussion-board/sending-raw-xml-payload/m-p/11606#M4459</guid>
      <dc:creator>woutf</dc:creator>
      <dc:date>2026-01-20T09:22:50Z</dc:date>
    </item>
    <item>
      <title>Re: Sending raw XML payload</title>
      <link>https://systematic.workato.com/t5/workato-pros-discussion-board/sending-raw-xml-payload/m-p/11607#M4460</link>
      <description>&lt;P&gt;yes, there is a simpler and correct way, but it requires bypassing Workato’s XML/JSON formatters entirely and sending the payload as a raw HTTP body, not as a structured request.&amp;nbsp;request_format_xml and request_format_raw are mutually exclusive with “send this string as-is”.&amp;nbsp;If Workato is serializing anything for you, it will always modify the payload.&lt;BR /&gt;&lt;BR /&gt;Do not use any request formatter and set the request body directly as a string:&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;xml_body = &amp;lt;&amp;lt;XML&amp;lt;?xml version="1.0"?&amp;gt;&amp;lt;!DOCTYPE cXML SYSTEM &lt;A href="http://xml.cxml.org/schemas/cXML/1.2.035/InvoiceDetail.dtd" target="_blank"&gt;http://xml.cxml.org/schemas/cXML/1.2.035/InvoiceDetail.dtd&lt;/A&gt;"&amp;gt;.......&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;post('receiveInbCXML')&lt;/STRONG&gt;&lt;STRONG&gt;.headers(&lt;/STRONG&gt;&lt;STRONG&gt;'Content-Type': 'application/xml'&lt;/STRONG&gt;&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;STRONG&gt;.body(xml_body)&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;This is the only way to forward cXML “as-is” in Workato.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jan 2026 16:32:11 GMT</pubDate>
      <guid>https://systematic.workato.com/t5/workato-pros-discussion-board/sending-raw-xml-payload/m-p/11607#M4460</guid>
      <dc:creator>francbaviello</dc:creator>
      <dc:date>2026-01-20T16:32:11Z</dc:date>
    </item>
  </channel>
</rss>

