How to work with Salesforce object for easy transform?
Step 1: Add the Salesforce object, to the latest version of the Salesforce enterprise wsdl, that we would like to expose and utilize in XSL transformation designer. The objects are created in your custom namespace (noted as YOURCOMPANY below). Be sure to name the element with the EXACT name of the type.
<schema elementFormDefault="qualified" xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:YOURCOMPANY.enterprise.soap.sforce.com" xmlns:ens="urn:sobject.enterprise.soap.sforce.com">
<import namespace="urn:sobject.enterprise.soap.sforce.com"/>
<element name="Opportunity" type="ens:Opportunity"></element>
</schema>
Step 2: Within the scope that you will be working with such object, create a variable of element type of what you created in Step 1.
<variable name="opp" element="ns10:Opportunity"/>
in this case, xmlns:ns10="urn:YOURCOMPANY.enterprise.soap.sforce.com"
Step 3: TransformToObj.xsl can be reused in each composite to map the custom object back to SObject.
?>
xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
xmlns:xp20="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.Xpath20"
xmlns:mhdr="http://www.oracle.com/XSL/Transform/java/oracle.tip.mediator.service.common.functions.MediatorExtnFunction"
xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
xmlns:oraext="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.ExtFunc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:dvm="http://www.oracle.com/XSL/Transform/java/oracle.tip.dvm.LookupValue"
xmlns:hwf="http://xmlns.oracle.com/bpel/workflow/xpath"
xmlns:wns="urn:YOURCOMPANY.enterprise.soap.sforce.com"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:med="http://schemas.oracle.com/mediator/xpath"
xmlns:ids="http://xmlns.oracle.com/bpel/services/IdentityService/xpath"
xmlns:bpm="http://xmlns.oracle.com/bpmn20/extensions"
xmlns:xdk="http://schemas.oracle.com/bpel/extension/xpath/function/xdk"
xmlns:xref="http://www.oracle.com/XSL/Transform/java/oracle.tip.xref.xpath.XRefXPathFunctions"
xmlns:fns="urn:fault.enterprise.soap.sforce.com"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="urn:enterprise.soap.sforce.com"
xmlns:ora="http://schemas.oracle.com/xpath/extension"
xmlns:socket="http://www.oracle.com/XSL/Transform/java/oracle.tip.adapter.socket.ProtocolTranslator"
xmlns:ens="urn:sobject.enterprise.soap.sforce.com"
xmlns:ldap="http://schemas.oracle.com/xpath/extension/ldap"
exclude-result-prefixes="xsi xsl wns fns xsd soap tns ens bpws xp20 mhdr bpel oraext dvm hwf med ids bpm xdk xref ora socket ldap">
<!--<xsl:output method="xml" indent="yes"/>-->
<xsl:template match="/">
<tns:update>
<tns:sObjects>
<xsl:attribute name="xsi:type" namespace="http://www.w3.org/2001/XMLSchema-instance">
<xsl:value-of select="local-name(/child::node())"/>
</xsl:attribute>
<xsl:for-each select="/child::node()/child::*">
<xsl:copy-of select="."/>
</xsl:for-each>
</tns:sObjects>
</tns:update>
</xsl:template>
</xsl:stylesheet>
No comments:
Post a Comment