This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package mine; | |
import ballerina.net.http; | |
@http:configuration {basePath:"/dolar"} | |
service<http> dolar { | |
endpoint | |
<http:HttpClient> httpConnector{ | |
create http:HttpClient("http://api.bcb.gov.br", {});} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<sequence name="GenerateInvoiceId" trace="disable" | |
xmlns="http://ws.apache.org/ns/synapse"> | |
<call blocking="true" description=""> | |
<endpoint> | |
<http method="get" uri-template="http://www.mocky.io/v2/594c61e4110000b10ea3d048"/> | |
</endpoint> | |
</call> | |
<enrich> | |
<source type="body" clone="true"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<sequence name="invoke-hotel-car-sequence_v2" trace="disable" xmlns="http://ws.apache.org/ns/synapse"> | |
<log> | |
<property name="Message Flow" value="Travel Sequence"/> | |
</log> | |
<call> | |
<endpoint> | |
<http method="get" uri-template="http://www.mocky.io/v2/594c61e4110000b10ea3d048"/> | |
</endpoint> | |
</call> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Verifying that "edgars.id" is my Blockstack ID. https://onename.com/edgars |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.wso2.ballerina.connectors.salesforcesoap; | |
import ballerina.lang.system; | |
import ballerina.lang.xmls; | |
import ballerina.net.http; | |
import ballerina.lang.messages; | |
import ballerina.lang.jsons; | |
@http:BasePath{value:"/query"} | |
service sfdc { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ballerina.data.sql; | |
import ballerina.lang.messages; | |
import ballerina.lang.datatables; | |
import ballerina.lang.jsons; | |
import ballerina.lang.exceptions; | |
import ballerina.lang.strings; | |
@http:BasePath("/employees") | |
service Employees { | |
string dbURL = "jdbc:mysql://localhost:3306/mycrm"; | |
string username = "root"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function responseException(string resourceName, exception e)(json ) { | |
string errorMessage = strings:trim(exceptions:getMessage(e)); | |
json payload = `{${resourceName}:${errorMessage}}`; | |
return payload; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@http:GET | |
@http:Path("/") | |
resource select(message m) { | |
sql:Parameter[] params = []; | |
try { | |
datatable dt = sql:ClientConnector.select(lcDBConnector, "select empno,ename,job,mgr,hiredate,sal,comm,deptno from emp", params); | |
json payload = datatables:toJson(dt); | |
message response = {}; | |
messages:setJsonPayload(response, payload); | |
reply response; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string dbURL = "jdbc:mysql://localhost:3306/mycrm"; | |
string username = "root"; | |
string password = "mysql"; | |
map propertiesMap = {"jdbcUrl":dbURL, "username":username, "password":password | |
} | |
; | |
sql:ClientConnector lcDBConnector = create sql:ClientConnector(propertiesMap); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ballerina.data.sql; | |
import ballerina.lang.messages; | |
import ballerina.lang.datatables; | |
import ballerina.lang.jsons; | |
import ballerina.lang.exceptions; | |
import ballerina.lang.strings; | |
@http:BasePath("/employees") | |
service Employees { | |
@http:GET |