Skip to content

Instantly share code, notes, and snippets.

View jdeoliveira's full-sized avatar

Jesus De Oliveira jdeoliveira

  • London
  • 14:51 (UTC +01:00)
View GitHub Profile
@jdeoliveira
jdeoliveira / gist:3026321
Created July 1, 2012 00:59
WCF retail service implementation
public class WCFRetailService : IWCFRetailService
{
public string CreateOrder(Order order) {
Random random = new Random();
int newOrderId = random.Next();
order.Id = newOrderId.ToString();
// do something with the order...
@jdeoliveira
jdeoliveira / gist:3026248
Created July 1, 2012 00:45
WCF retail order service interface
[ServiceContract]
public interface IWCFRetailService
{
[OperationContract]
string CreateOrder(Order order);
}
@jdeoliveira
jdeoliveira / gist:3026233
Created July 1, 2012 00:40
WCF order representation
[DataContract]
public class Order
{
private String id;
private String productId;
private String quantity;
[DataMember]
public String Id
{
@jdeoliveira
jdeoliveira / gist:3019077
Created June 29, 2012 16:40
Construction of the credit rejection response by a PHP script
<scripting:component doc:name="Prepare rejection response">
<scripting:script engine="php">
<scripting:text>
<![CDATA[
<?php
$request = json_decode($payload, true);
$response["outcome"] = $message->getProperty("outcome");
@jdeoliveira
jdeoliveira / gist:3019061
Created June 29, 2012 16:37
Analyze credit request PHP script
<scripting:component doc:name="Analyze credit request">
<scripting:script engine="php">
<scripting:text>
<![CDATA[
<?php
$log->info("Hello from PHP, mule!");
$request = json_decode($payload, true);
@jdeoliveira
jdeoliveira / gist:3018993
Created June 29, 2012 16:29
Bad credit request
{"customerId": "DEF992", "requestedAmount": "3000", "averageIncome": "1000" }
@jdeoliveira
jdeoliveira / gist:3018981
Created June 29, 2012 16:29
Good credit request
{"customerId": "ABC123", "requestedAmount": "15000", "averageIncome": "5000" }
@jdeoliveira
jdeoliveira / gist:3018971
Created June 29, 2012 16:26
Complex flow with PHP as the scripting language
<flow name="flow" doc:name="flow">
<http:inbound-endpoint exchange-pattern="request-response"
host="localhost" port="8081" path="runPHP" doc:name="HTTP" />
<object-to-string-transformer doc:name="Object to String" />
<scripting:component doc:name="Analyze credit request">
<scripting:script engine="php">
<scripting:text>
<![CDATA[
<?php
@jdeoliveira
jdeoliveira / gist:3018703
Created June 29, 2012 15:41
PHP scripting component
<scripting:component doc:name="Script">
<scripting:script engine="php">
<scripting:text>
<![CDATA[
<?php
$log->info("Hello from PHP, mule!");
$msg = "Hello from PHP! You requested the path: " . $payload;
return $msg;