Questions tagged [ballerina]

For questions about the Ballerina programming language

Ballerina (sometimes referred to as "Ballerina lang" or “Ballerinalang”) is an open-source programming language for the cloud that makes it easier to use, combine, and create network services. Ballerina is designed and developed by WSO2 together with the open-source community.

Type system

Ballerina is a statically typed, concurrent programming language focusing on network interactions and structured data. It has all the general-purpose functionality expected of a modern programming language, but several distinctive aspects make it particularly suitable for its intended purpose.

Ballerina provides language constructs specifically for consuming and delivering network services. Its abstractions and syntax for concurrency and network interaction have been designed to closely correspond with sequence diagrams. This enables a bidirectional mapping for any Ballerina function between its textual representation in the syntax and its graphical representation as a sequence diagram.

Ballerina has a structural type system that is more flexible and allows for looser coupling than traditional statically typed languages. Ballerina's data types are designed to work particularly well with structured data over network interactions by providing first-class support for JSON, XML, tabular data, etc.

Ballerina platform

The Ballerina language has been designed in conjunction with the Ballerina platform, which provides comprehensive support for a module-based software development model, including versioning, dependency management, testing, documentation, building, and sharing.

Code to Cloud

Ballerina Code to Cloud is designed to allow developers to write code without thinking about the deployment platform. This dramatically simplifies the experience of developing and deploying Ballerina code in the cloud.

Ballerina compiler can read configuration files and other first-class cloud-related constructs in the source code and generate artifacts to deploy the code into different clouds. These artifacts can be Dockerfile, Docker image, Kubernetes YAML's, or serverless functions required to deploy the code into different clouds.

Library

The Ballerina language includes a lang library, which provides fundamental operations on the data types defined by the language. The Ballerina platform includes an extensive standard library, which consists of the usual low-level, general-purpose functionality and support for a wide variety of network protocols, interface standards, data formats, authentication/authorization standards, etc. It makes writing secure and resilient distributed applications significantly easier than with other languages.

Ballerina reference documentation

Get started tutorials

Other resources

469 questions
0
votes
1 answer

How to get only the actual body content of a Email in Ballerina

I want to read the content of a email using Ballerina Gmail package.Is there any built in mechanism to read only the actual body content of the email excluding the signature of the sender.
ThiliniD
  • 13
  • 2
0
votes
1 answer

how to find predefined timezone IDs of ballerina time package?

In ballerina time packages createTime function, it asks for zoneID as a function parameter, when I provide a custom zoneID, program keeps running without any output. Is there a way to find those predefined time zoneIDs with relevant timezones?
0
votes
1 answer

Code for "Create a Client for Calculator Service" in documentation not working

Sorry for asking a very basic question, I am new to Ballerina and do not really know how to proceed with this. I copy pasted the code in "Create a Client for Calculator Service" in the ballerina documentation which is: import ballerina/http; import…
Suleka_28
  • 2,761
  • 4
  • 27
  • 43
0
votes
1 answer

Ballerina package build failed

I followed the Ballerina quick tour on https://ballerina.io/community-program/ and created the package 'Calculator' and everything worked perfectly until the package building step. After the build command is entered an error appears. ballerina…
Senuri De Silva
  • 112
  • 1
  • 5
0
votes
1 answer

Ballerina Enable or disable JMS connection

In ballerina JMS is a service and so if we want to initiate JMS connection only in a specific condition we cannot achive that. So is it possible to achive it? If not is there any way to start the JMS service based on the condition?
ruks
  • 376
  • 3
  • 8
0
votes
2 answers

How to convert json to string in Ballerina?

In Ballerina I have a JSON object like this json players = { "123": {"x":500, "y":400}, "345": {"x": 300, "y":200} } I would like get an string from this object like: string text = check players; This gives a runtime error: 'json'…
Riyafa Abdul Hameed
  • 7,417
  • 6
  • 40
  • 55
0
votes
2 answers

Is it possible to define default resources for a Ballerina service?

Trying to see if i can expose curl http://localhost:9090/studentinfo?schoolId=12341324, where "studentinfo" is the service path. @http:ServiceConfig { basePath: "/studentinfo" } service studentInfo bind studentInfoListener { …
0
votes
1 answer

Could not find package when running Ballerina code

I have copy all the required jar files into /bre/lib/. jar files were downloaded from here, https://github.com/wso2-ballerina/package-mongodb/releases/download/v0.5.5/wso2-mongodb-0.5.5.zip Just simply import on the top of the code, still running…
0
votes
2 answers

Unable to invoke localhost https REST service in Ballerinalang and give a timeout error?

I've implemented a Ballerina(ballerina 0.91) service to invoke https REST service which running on localhost. I used http:ClientConnector to call that service. This is my sample code. http:ClientConnector clientConnector = create…
Buddhi
  • 839
  • 10
  • 15
0
votes
1 answer

How can I invoke a SOAP-XML WS with Ballerina

I'm trying to invoke a SOAP WS using Ballerina, and the http:ClientConnector, how can I to pass the Body and parameters to the POST method?
0
votes
1 answer

Got a timeout error when I send an email using gmail:ClientConnector in ballerinalang

I try to implement a program in ballerina to send an email using ballerina gmail:ClientConnector with gmail API. But it gives a timeout error like below. error: ballerina.lang.errors:Error, message: failed to invoke 'post' action in ClientConnector.…
Buddhi
  • 839
  • 10
  • 15
0
votes
2 answers

Can't save ballerina code create using composer

when I try to save ballerina code create using composer flowing error occur. SyntaxError: Failed to execute 'open' on 'XMLHttpRequest': Invalid URL How I solve this problem?
Gihan Chathuranga
  • 442
  • 10
  • 16
0
votes
1 answer

"Error in BLang parser rest service for composer" when run the composer

When I'm run the composer using CMD. Composer run properly.But this error appears in the console. C:\>composer 2017-07-07 23:09:05,446 INFO - Ballerina Composer URL: http://localhost:9091 2017-07-07 23:09:35,164 ERROR - Error in BLang parser rest…
Sachith Wickramaarachchi
  • 5,546
  • 6
  • 39
  • 68
0
votes
1 answer

Automatically convert XML to JSON in Ballerina

In WSO2 ESB, changing some properties is possible to change the messageType from XML to JSON, what about the easiest way, even not caring about the format, tags, whatsoever, here an example: string SfID = xmls:getString(soapResponse,…
0
votes
1 answer

How to get started on ballerina composer?

I was looking at the documentation provided in here at ballerinalang.org. This documentation is very helpful. But is there a documentation on introduction to the composer? any articles or anything?
Nipuna Marcus
  • 213
  • 1
  • 6