Send Message Operation Failure

If the send message operation fails with an error similar to the following, the uploadType query parameter is mapped with the wrong value.

<genericRestFault>
   <errorCode>REST_REQ_HDR_ERR</errorCode>
      <errorPath>
         <![CDATA[An error occurred while processing headers in the target REST  endpoint.]]>
      </errorPath>
   <instance>
      <![CDATA[Target REST endpoint headers could not be set.[[The values accepted for query parameter uploadType are [media,multipart, resumable] but found 'media' instead.]]]]>
   </instance>
</genericRestFault>

The uploadType query parameter is hard-coded in the mapper and enclosed with quotes. The send message operation sends mail from the account used in the connection. It expects the value to be of MIME content. If the send message operation fails with an error similar to the following, the reason is that invalid MIME content is mapped to a raw element.

"error": {
 "errors": [
  {
   "domain": "global",
   "reason": "invalidArgument",
   "message": "Recipient address required"
  }
 ],
 "code": 400,
 "message": "Recipient address required"
}
Sample mail content is shown below:
From: sender@email.com
To: receiver@email.com
Subject: Mail Subject
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
    
    Dear Sender,
        
        This is a sample mail sent using ICS Google Mail Adapter.

        Thank You!!

Regards,
Sender
The above mail content can be built using the XSLT mapper with the following steps.
  1. Export the flow from Oracle Integration.

  2. Manually edit the mapper XSLT with required values in the format using the sample provided below.

  3. Save the XSLT and re-import the flow into Oracle Integration.

    <xsl:template match="/" xml:id="id_11">
        <xsl:variable name="emailContent">
            <xsl:value-of select="concat('From: ','sender@email.com')"/>
            <xsl:text>&#xa;</xsl:text>
            <xsl:value-of select="concat('To: ','receiver@email.com')"/>    
            <xsl:text>&#xa;</xsl:text>
            <xsl:value-of select="concat('Subject: ','Mail Subject')"/>
            <xsl:text>&#xa;</xsl:text>
            <xsl:value-of select="concat('MIME-Version: ','1.0')"/>         
            <xsl:text>&#xa;</xsl:text>
            <xsl:value-of select="concat('Content-Type: ','text/plain; charset=utf-8')"/>
            <xsl:text>&#xa;</xsl:text>
            <xsl:value-of select="concat('Content-Transfer-Encoding: ','7bit')"/>
            <xsl:text>&#xa;</xsl:text>
            <xsl:text>&#xa;</xsl:text>
            <xsl:value-of select="'    Dear Sender,'"/>
            <xsl:text>&#xa;</xsl:text>
            <xsl:text>&#xa;</xsl:text>
            <xsl:value-of select="'This is a sample mail sent using ICS Google Mail Adapter.'"/>
            <xsl:text>&#xa;</xsl:text>
            <xsl:text>&#xa;</xsl:text>
            <xsl:value-of select="'    Thank You!!'"/>
            <xsl:text>&#xa;</xsl:text>
            <xsl:text>&#xa;</xsl:text>
            <xsl:value-of select="'Regards,'"/>
            <xsl:text>&#xa;</xsl:text>
            <xsl:value-of select="'Sender'"/>
        </xsl:variable>
        <nstrgmpr:sendMsg xml:id="id_12">
            <nstrgmpr:Messages.definitions.requestPayLoadForSendMsg xml:id="id_18">
                 <nstrgmpr:raw xml:id="id_19">
                      <xsl:value-of select="$emailContent"/>
                 </nstrgmpr:raw>
            </nstrgmpr:Messages.definitions.requestPayLoadForSendMsg>
            <nstrgmpr:QueryParameters xml:id="id_16">
                 <nstrgmpr:uploadType xml:id="id_17">media</nstrgmpr:uploadType>
            </nstrgmpr:QueryParameters>
        </nstrgmpr:sendMsg>
    </xsl:template>