Skip to content

Instantly share code, notes, and snippets.

View GDLMadushanka's full-sized avatar
😇

Lahiru Madushanka GDLMadushanka

😇
View GitHub Profile
@GDLMadushanka
GDLMadushanka / SpaceX_Sample_1.xml
Created November 17, 2018 07:25
JSON support in Aggregate mediator
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="AggregateMessageProxy"
transports="http https"
startOnLoad="true">
<description/>
<target>
<inSequence>
<property name="enclosing_element" scope="default">
<Aggregated_Stations/>
@GDLMadushanka
GDLMadushanka / NewConfiguration.xml
Created November 17, 2018 07:43
New configuration for aggregate mediator
<aggregate>
<correlateOn expression="xpath | json-path"/>?
<completeCondition [timeout="time-in-seconds"]>
<messageCount min="int-min" max="int-max"/>?
</completeCondition>?
<onComplete expression="xpath | json-path" [sequence="sequence-ref"]>
(mediator +)?
</onComplete>
</aggregate>
@GDLMadushanka
GDLMadushanka / EnrichMediatorOldsyntax.xml
Created December 11, 2018 12:38
Old syntax of the Enrich mediator in WSO2EI
<enrich>
<source [clone=true|false] [type=custom|envelope|body|property|inline] xpath="" property="" />
<target [action=replace|child|sibiling] [type=custom|envelope|body|property|inline] xpath="" property="" />
</enrich>
@GDLMadushanka
GDLMadushanka / EnrichMediatorNewsyntax.xml
Created December 11, 2018 13:03
Introducing new syntax for WSO2 EI enrich mediator
<enrich>
<source [clone=true|false] [type=custom|envelope|body|property|inline] xpath|json-path ="" property="" />
<target [action=replace|child|sibiling] [type=custom|envelope|body|property|inline] xpath|json-path="" property="" />
</enrich>
@GDLMadushanka
GDLMadushanka / SamlpleConfiguration.xml
Created December 12, 2018 09:10
Sample configurations for Enrich mediator
<!-- Sample 01 -->
<enrich>
<source type="custom" xpath="json-eval($.SamplePayload)" clone="false"/>
<target action="replace" type="body"/>
</enrich>
<!-- Sample 02 -->
<property name="Greeting" value="Hello World"/>
<enrich>
<source type="property" clone="true" property="Greeting"/>
// Sample 01
// Request 1
{
"SamplePayload": {
"SampleArray": [
123.45
]
}
}
@GDLMadushanka
GDLMadushanka / nonSecure.cs
Created March 11, 2019 00:04
Calling a non secure web-service using C#
private void button1_Click(object sender, EventArgs e)
{
echoService.echoPortTypeClient client = new echoService.echoPortTypeClient("echoHttpSoap11Endpoint");
CallProxyApplication.echoService.echoStringRequest echoStringRequest = new echoService.echoStringRequest();
CallProxyApplication.echoService.echoStringResponse echoStringResponse = new echoService.echoStringResponse();
echoStringRequest.@in = textBox1.Text;
try
{
String response = client.echoString(echoStringRequest.@in);
@GDLMadushanka
GDLMadushanka / customBinding.xml
Created March 11, 2019 00:24
Sample customBinding configuration
<binding name="echoSecuredSoap11Binding1">
<security defaultAlgorithmSuite="Basic256" authenticationMode="UserNameOverTransport"
requireDerivedKeys="true" securityHeaderLayout="Lax" includeTimestamp="true">
<localClientSettings detectReplays="false"/>
<localServiceSettings detectReplays="false"/>
</security>
<textMessageEncoding messageVersion="Soap11"/>
<httpsTransport/>
</binding>
@GDLMadushanka
GDLMadushanka / callSecureWebService.cs
Created March 11, 2019 00:28
Calling a secure web service via C#
private void button2_Click(object sender, EventArgs e)
{
echoSecured.echoSecuredPortTypeClient client = new echoSecured.echoSecuredPortTypeClient("echoSecuredHttpsSoap11Endpoint");
CallProxyApplication.echoSecured.echoStringRequest echoStringRequest = new echoSecured.echoStringRequest();
CallProxyApplication.echoSecured.echoStringResponse echoStringResponse = new echoSecured.echoStringResponse();
client.ClientCredentials.UserName.UserName = "admin";
client.ClientCredentials.UserName.Password = "admin";
echoStringRequest.@in = textBox2.Text;
@GDLMadushanka
GDLMadushanka / Lab01.xml
Created July 14, 2019 05:16
DataTypes XML
<Student>
<Name>Lahiru</Name>
<Marks>78</Marks>
</Student>