Skip to content

Commit

Permalink
Add get server timestamp method
Browse files Browse the repository at this point in the history
  • Loading branch information
sybernix committed Jun 1, 2020
1 parent af68890 commit 470e81f
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 0 deletions.
4 changes: 4 additions & 0 deletions connector/src/main/resources/salesforce/component.xml
Expand Up @@ -124,5 +124,9 @@
<file>getUpdated.xml</file>
<description>Get Updated Records synapse library</description>
</component>
<component name="getServerTimestamp">
<file>getServerTimestamp.xml</file>
<description>Get Server Timestamp synapse library</description>
</component>
</subComponents>
</component>
91 changes: 91 additions & 0 deletions connector/src/main/resources/salesforce/getServerTimestamp.xml
@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~
~ WSO2 Inc. licenses this file to you under the Apache License,
~ Version 2.0 (the "License"); you may not use this file except
~ in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
-->
<template name="getServerTimestamp" xmlns="http://ws.apache.org/ns/synapse">
<parameter name="sObjectType" description="The sobject type"/>
<parameter name="startDate" description="The start date for deleted records lookup"/>
<parameter name="endDate" description="The end date for deleted records lookup"/>
<sequence>
<property
expression="get-property('operation','salesforce.serviceUrl')"
name="uri.var.salesforce.url"/>
<payloadFactory>
<format>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:urn="urn:partner.soap.sforce.com">
<soapenv:Header>
<urn:SessionHeader>
<urn:sessionId>$1</urn:sessionId>
</urn:SessionHeader>
</soapenv:Header>
<soapenv:Body>
<urn:getServerTimestamp/>
</soapenv:Body>
</soapenv:Envelope>
</format>
<args>
<arg expression="get-property('operation','salesforce.sessionId')"/>
<arg expression="$func:sObjectType"/>
<arg expression="$func:startDate"/>
<arg expression="$func:endDate"/>
</args>
</payloadFactory>
<property name="messageType" scope="axis2" value="text/xml"/>
<header name="Action" value="urn:partner.soap.sforce.com/Soap/getServerTimestampRequest"/>
<property value="true" name="FORCE_ERROR_ON_SOAP_FAULT"/>
<property name="HTTP_METHOD" scope="axis2" value="POST"/>
<header name="To" expression="$ctx:uri.var.salesforce.url"/>
<filter source="$ctx:SALESFORCE_BLOCKING" regex="true">
<then>
<call blocking="true">
<endpoint>
<default format="soap11">
<timeout>
<duration>60000</duration>
<responseAction>fault</responseAction>
</timeout>
<suspendOnFailure>
<initialDuration>2000</initialDuration>
<progressionFactor>1.0</progressionFactor>
<maximumDuration>3000</maximumDuration>
</suspendOnFailure>
</default>
</endpoint>
</call>
</then>
<else>
<call>
<endpoint>
<default format="soap11">
<timeout>
<duration>60000</duration>
<responseAction>fault</responseAction>
</timeout>
<suspendOnFailure>
<initialDuration>2000</initialDuration>
<progressionFactor>1.0</progressionFactor>
<maximumDuration>3000</maximumDuration>
</suspendOnFailure>
</default>
</endpoint>
</call>
</else>
</filter>
</sequence>
</template>

0 comments on commit 470e81f

Please sign in to comment.