Skip to content

Instantly share code, notes, and snippets.

@edegula
edegula / sap-connector-rfc-read-table.xml
Created June 3, 2021 00:39
RFC_READ_TABLE XML sample for Mulesoft SAP Connector
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<RFC_READ_TABLE>
<import>
<DELIMITER>|</DELIMITER>
<NO_DATA/>
<QUERY_TABLE>PRPS</QUERY_TABLE>
<ROWCOUNT>0</ROWCOUNT>
<ROWSKIPS>0</ROWSKIPS>
</import>
<tables>
@edegula
edegula / raml-enum-multiple-values.yaml
Last active June 2, 2021 06:27
RAML for queryParameters that accepts multiple values.
#%RAML 1.0
---
title: test
version: v2
protocols: [ HTTP ]
mediaType: application/json
traits:
sparsable:
queryParameters:
@edegula
edegula / Converting JDBC Lookup DataBaseResult to XML.java
Created July 24, 2020 02:03
Converting a JDBC Lookup DataBaseResult object to an XML
public String executeQuery(Container container) throws StreamTransformation {
AbstractTrace trace = container.getTrace();
trace.addInfo("Starting lookup");
String sqlQuery = "SELECT PICKLIST_NUMBER, ITEMORDER, SAP_MATERIAL, DESCRIPTION, UOM, WEIGHT FROM MACRO_INGREDIENTS WHERE PICKLIST_NUMBER = '256' ORDER BY ITEMORDER";
Map inputParam = new HashMap();
inputParam.put(StreamTransformationConstants.MAPPING_TRACE, container.getTrace());
@edegula
edegula / Processing node-set via templates in XSLT.xsl
Created July 24, 2020 01:32
Processing node-set via templates in XSLT 1.0
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ext="http://exslt.org/common">
<xsl:output indent="yes" method="xml"/>
<xsl:variable name="source">
<ResultSet>
<Record>
<ITEMORDER>1</ITEMORDER>
<!-- input.xml -->
<!-- <date>2017-02-05T10:40:00+04:00</date> -->
<!-- convert_local_datetime_to_utc.xsl -->
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:saxon="http://saxon.sf.net/"
exclude-result-prefixes="xs saxon">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
@edegula
edegula / gist:a53bf5d8f2801c64e750a7526f03284b
Created April 23, 2019 23:58
XSLT 3.0 - JSON to XML conversion
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:math="http://www.w3.org/2005/xpath-functions/math"
xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl"
xmlns:emp="http://www.semanticalllc.com/ns/employees#"
xmlns:h="http://www.w3.org/1999/xhtml"
xmlns:fn="http://www.w3.org/2005/xpath-functions"
xmlns:j="http://www.w3.org/2005/xpath-functions"
exclude-result-prefixes="xs math xd h emp"
@edegula
edegula / choco.bat
Created November 21, 2018 23:31
Installing choco
@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
@edegula
edegula / setMPLCustomHeaderProperty.groovy
Created November 14, 2018 10:18
SAP CPI - Adding a Custom Header Property to the Message Processing Logs
import com.sap.gateway.ip.core.customdev.util.Message;
def Message setMPLCustomHeaderProperty(Message message) {
def messageLog = messageLogFactory.getMessageLog(message);
messageLog?.addCustomHeaderProperty("SalesOrder", "XXX10202910129XXX")
return message
}
@edegula
edegula / getCredentials.groovy
Last active July 28, 2021 13:58
CPI - Get Credentials from Secure Store
def Message getCredentials( Message message ) {
def service = ITApiFactory.getApi(SecureStoreService.class, null)
def credential = service.getUserCredential("UPLOADED_CREDENTIAL_IN_SECURE_STORE")
if (credential == null){
throw new IllegalStateException("No credential found for alias 'UPLOADED_CREDENTIAL_IN_SECURE_STORE'")
}
String userName = credential.getUsername()
String password = new String(credential.getPassword())
@edegula
edegula / contact_query.xsl
Created May 17, 2015 14:15
Contact Query
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns0="urn:test.com:corp:sf:rng:managemasterdata">
<xsl:output omit-xml-declaration="no" indent="yes"/>
<xsl:strip-space elements="*"/>
<!-- Create the Contact Query XML -->
<xsl:template match="/">
<Contact>
<Operation>Query</Operation>
<ObjectType>Contact</ObjectType>
<Condition>