Featured

Blockchain Technology in e-governance of Bangladesh

Computer Jagat has published my writing on “E-governance and Blockchain Technology” as cover article in Nov 2018 issue. It contains some major characteristics of blockchain technology and its importance in Bangladesh e-governance sector including some use cases. You will find the full article form here : https://bit.ly/2qTgzl5

 

Featured

A Beginner’s Guide to Blockchain

What is blockchain?

A ledger is the principal book or computer file for recording economic transactions.  Blockchain  is a common ledger where  transaction informations are kept forming a block after block thus creates a chain which distributed, synced and shared between the participating stackholders.

Just think about common register book of office where daily attendance is noted. This book can be assumed as a ledger and entries are like transaction info which is not distributed and it has exactly one copy at any time (the current book).

Lets think another paradigm where everyone will maintain his attendace in his own register book provided by office. At the end of the month everyone’s attendance info will be copied in master register book. That is master register book will have all the attence info at the end of month. If anyone wants know others’ attendance he has to just find in master register book. But still it is only possible at the end of the month. What should we need to do if everyone wants know anyone’s attendacne in any day. That is only possible if everyone share his attendace info with others  and others people sync with their attendace info from everyone daily. Then everoyone  will have the same information at any day. So here the the attendace info (transactions) in a register book (ledger) is being maintaning like a distributive way. NB: just forget about the Block concept for the time being. These are very basic things of blockchain.

dc.jpeg

Blockchain is a global but Not Shared ledger  which Distributed to all peers of the network having no centralized server  where Every peer has the exact copy of the ledger.

How does blockchain work?

Proof of work

proof of work is a piece of data which is difficult (costly, time-consuming) to produce but easy for others to verify and which satisfies certain requirements.  

Cryptographic hash function:  which create a totally different hash for  each different input. Let assume that we a string Hello, world! as input and SHA256 generates a hash value: 1312af178c253f84028d480a6adc1e25e81caa44c749ec81976192e2ec934c64

Then any change in Hello, world! will create a totally different hash value.

SHA256(‘"Hello, world!“) => 1312af178c253f84028d480a6adc1e25e81caa44c749ec81976192e2ec934c64
SHA256(‘"Hello, world!1“) => 1312af178c253f84028d480a6adc1e25e81caa44c749ec81976192e2ec934c64
……..
……..
SHA256("Hello, world!4250“) => 0000c3af42fc31103f1fdc0151fa747ff87349a4714df7cc52ea464e12dcd4e9

Now consider a situation where there will be exactly 0000 at the starting of the hash value. We don’t actually know how can we create the hash from Hello, world! string. Hashing Hello, world! each time will generate the same hash 1312af178c253f84028d480a6adc1e25e81caa44c749ec81976192e2ec934c64. So we can append some value like 1, 2, 3 ….. till we meet our condition eg: any hash with 0000 at the starting. Finally we can generate our required hash after appending 4250 that is Hello, world!4250. In  this case the value is 4250  which we don’t know. The only way to know the value is iterate over  1  to N=2^256.  This 4250 value is called nonce . So in this case nonce=4250. This number 4 is called difficulty.

 

Difficulty

Blockchain difficulty (starting with N-number of zero) is changed dynamically to make block creation time ( 10min for bitcoin) as day by day more miners are getting included.

Miner

Miner are listening for transactions, create new block, broadcast block  and getting rewarded with new money(This is called cryptocurrency)

  • Can perform two things

  1)Validating transaction (easy )

   2)Key (special  hash) generation (time-consuming and lots of computational works are needed)

  • Miners work in a competitive way to get reward at first.
  • Miners try again and again to validate transactions.

Genesis block

The genesis block is the first block of any blockchain. It is the only block which does not contain a hash referring to a previous block. In many practical solutions, this block is itself hardcoded in software.
genesisg2

 

Cryctocurrency

  • Nobody can create new cryctocurrency manually other than mining(which is totally automated) as there is no central control like central bank.
  • Initially there was 0 currency in the network.
  • All the currencies available now have been mined by miners.
  • So number of currencies are increasing day by day.
  • User can send an extra reward for validating its transaction but this is not mining.

Blockchain is not Bitcoin. Blockchain is the technology that makes bitcoin possible.

 

 

Land Verification system using Blockchain Technology

Introduction

If we talk about land verification system using blockchain technology, it indirectly means the land registration system with blockchain technology. Unless we store land registration information in the blockchain system, we cannot take the benefits of blockchain technology to verify it. So, in our proposal we will briefly discuss about current land registration system, challenges faced in our traditional system, finally how we can solve those challenges through the use of blockchain technology.

Land Registration

Land registration generally describes systems by which matters concerning ownership, possession or other rights in land can be recorded (usually with a government agency or department) to provide evidence of title, facilitate transactions and to prevent unlawful disposal. The information recorded and the protection provided will vary by jurisdiction.

It is a process of officially and legally recording land or built property rights through deeds or title certification. It publicly shows that there is an official record of ownership with inherent rights through that ownership.

The land registry office in our country is typically responsible for various matter e.g.:

  • Matters concerning ownership, possession or other rights of real land/property are recorded and preserved;
  • Records are maintained regarding land and other real estate to properly assess its value and to collect property taxes;
  • Internal confidence between its people, commercial enterprises and its government are manifested and promoted (However, this is not always the case. It’s too easy to pick a country which does not have the trust of its people);
  • The documents and data that are recorded is usually the information that shows legal ownership and provides individual and enterprise protection.

How to check the ownership of a property in Bangladesh currently?

In Bangladesh, dispute with property ownership is very common. Documents related to property are easily forged and unreliable. If any person, while buying a property, is not cautious, might face problems, possibly litigation with the ownership of the property at a later stage. However, checking ownership of property in Bangladesh is a laborious job.

To check the ownership of a property, a buyer should do the following:

Collecting information about the property:

  1. Establishing chain of history of the property
  2. Authenticity of the title deed(s):
  3. Check the khatian/porcha:
  4. Check the mutation khatian:
  5. If the property is leased from government
  6. Tax record
  7. Physical verification of the property:

Land registration procedures in Bangladesh

The following steps are required to complete if anyone likes to buy an apartment or a piece of land for either residential or business purposes:

  1. Confirm the record of rights from the Land Office
  2. Conduct mutation on property
  3. Obtain inspection for RS mutation
  4. Obtain the non-encumbrance certificate from the relevant sub-registry office
  5. Prepare deed of transfer and pay stamp duty
  6. Pay capital gains tax, registration fee, VAT and other taxes at a designated bank
  7. Apply for registration at the relevant Sub-registry
  8. Register the change in ownership at the Land Revenue Office

 

 

 

Challenges in the current Land Registry System

In our existing system there are a lot of challenges.

  • Ownership Verification – One of the challenges faced by land registration authorities worldwide is to ensure ownership verification.
  • Ownership History – On many occasions, many properties do not have a recorded ownership history. Having access to the complete ownership history for an asset (e.g. block of land) increases trust when transacting with unknown parties.
  • Unauthorized sale of lands – Properties may get sold without authorization causing financial damage to the owners or insurance companies.
  • Delays in Ownership Transfer – Paper-based land registration and ownership transfer are prolonged taking more than a month. Inaccurate valuation of the properties can lead to incorrect tax or insurance premiums.
  • Failure to detect scams – Current paper-based or digital records fail to prevent frauds and identity theft that can lead to illegal sales.

 

Use of blockchain in land registry system

A blockchain, originally block chain, is a growing list of records, called blocks that are linked using cryptography. Each block contains a cryptographic hash of the previous block, a timestamp, and transaction data. Only blockchain can solve the challenges because of the characteristics of blockchain. The major characterizes of blockchain   are:- 

  • Immutability: the creation of data records that are permanent (cannot be changed or deleted);
  • Traceability: Using blockchain an item can be easily tracked to find the provenance in the transaction history.
  • Security: Blockchain is considered to be a highly secure system due to its digital signature and encryption. The system is specially designed to be secure, convenient, and tamper-proof.
  • Time-stamping: every entry created in the blockchain is securely tracked with a time-stamp (permanency makes backlogging impossible);
  • No Single point of failure: The ledger is distributed across every single node in the blockchain who are the participants. So, it is distributed.
  • Fraud prevention: Since various consensus protocols are needed to validate the entry, it removes the risk of duplicate entry or fraud
  • Transparency: The transactions that take place are transparent. The individuals who are provided authority can view the transaction.
  • Smart Contracts: With the smart contracts, the businesses can pre-set conditions on the blockchain. The automatic transactions are triggered only when the conditions are met.

Types of blockchain

There are at least four types of blockchain networks

1) Public Blockchain: – Anyone can participate in a public blockchain because it is open-source and public to all where no one is in charge. There is no access or rights management done for a public blockchain and anyone can be the part of the consensus. All transactions are public, and all nodes are equal. The best-known public blockchains used for cryptocurrency are Bitcoin and Ethereum

2) Private Blockchain: – A private blockchain is an invitation-only network governed by a single entity. Entrants to the network require permission to read, write or audit the blockchain. Private Blockchain allows organizations to employ distributed ledger technology without making data public. Hyperledger fabric is an example of private blockchain.

3) Consortium Blockchain: – a hybrid type that operates under the leadership of a group of member companies instead of a single entity. Examples of consortium blockchains would be: Quorum and Corda.

4) Hybrid Blockchain: – A hybrid blockchain has a combination of centralized and decentralized features. The exact workings of the chain can vary based on which portions of centralization decentralization are used. Example: DragonChain

Again based on permission before joining the network blockchain can two types:-

  • Permissioned blockchain – which allows only known nodes to participate in the network. Example :- Hyperledger fabric
  • Permissionless blockchain – anyone and anything can become part of a permissionless blockchain. Example :- Bitcoin, Ethereum

 

Private and Permissioned blockchains are faster, more efficient and more cost-effective than public and permissionless blockchains.

Based on characteristics of our land registry and verification system, we highly propose that Hyperledger fabric platform is most suitable platform to solve our problem.  Because our land information should not be public blockchain as well as anyone should not connect to land registry blockchain platform without proper authorization.

Why Hyperledger fabric is chosen?

There are some others reason too for choosing hyperledger fabric as blockchain platform. They are:-

  • Build in permissions: – Hyperledger Fabric comes with a full permission system. You can choose who will be able to access your blockchain and at what level they get access
  • Transaction Consensus: – Hyperledger will come to a consensus on transactional level. This means for a transaction to be considered valid, the whole block doesn’t need to be validated, but only the transaction.
  • Chaincode support: – As for now Hyperledger fabric supports NodeJs, Java or Go code.
  • No cryptocurrency needed: – Hyperledger can run without implementing a cryptocurrency unlike etheruem.
  • No Proof of work/proof of stake: – Hyperledger doesn’t need computers solving problems day and night, Hyperledger doesn’t need people to have cryptocurrency to reach consensus.
  • Open source supported by IBM: – Hyperledger fabric is maintained by IBM and it has been open source too.

 

 

Stakeholders

We have identified three stakeholders so far (not limited to).

  • Ministry of Land(WRITE and READ permission)
  • Ministry of Public administration (only READ permission)
  • Ministry of Home Affairs(only READ permission)

Proposed components of our Hyperledger Fabric based System

For our practical experiment we need the following components of Fabric:

  1. Membership Service Provider (or Certificate Authority) -Membership Service Provider (MSP) is a component that aims to offer an abstraction of a membership operation architecture. In particular, MSP abstracts away all cryptographic mechanisms and protocols behind issuing and validating certificates, and user authentication. Each organization will maintain their own MSP.

 

  1. Orderer – Orderer peer is considered as the central communication channel for the Hyperledger Fabric network. Orderer peer/node is responsible for consistent Ledger state across the network. Orderer peer creates the block and delivers that to all the peers. There will be multiple number of orderer.

 

  1. Peer – Peer receives ordered ledger state updates in the form of blocksfrom the orderer and maintains the state of the ledger. Peers can additionally take up a role of an endorsing peer. Chaincode (similar to Ethereum Smart Contract) installed in peers. There will multiple number of peer for each organization. There are different types of peer nodes with different roles in the network:
    1. Endorser peer
    2. Anchor peer
    3. Orderer peer

 

  1. OrganizationOrganizations logically separates members (peers) and the may or may not share the MSPs.It is recommended to have one MSP per organization and we follow that recommendation. In our case, our stakeholders are the organization
  1. Channel -A Hyperledger Fabric channel is a private “subnet” of communication between two or more specific network members, for the purpose of conducting private and confidential transactions. Each peer of every organization that joins a channel, has its own identity given by a membership services provider (MSP), which authenticates each peer to its channel peers and services.
  1. Smart contracts (chaincode) – A smart contract is an agreement between two people in the form of computer code. They run on the blockchain, so they are stored on a decentralized database and cannot be changed. The transactions that happen in a smart contract processed by the blockchain, which means they can be sent automatically without a third party. So far we have identified three smart contracts (not limited) in our blockchain system. They are for :-
    1. Mutaion(NaamJari)
    2. Khatiyan Record
    3. Land Tax Record

 

  1. REST API server – This server provides a convenient REST interface for web applications to transact on Hyperledger network. It uses Node.js SDK API to call peers, orderer and CA servers of network’s members. The API server is meant to be run by each member organization. It manages user authentication, interacts with peers and passes events to the client.

 

  1. Traditional Land Management System – Land Management system e.g. https://land.gov.bd/ or online system of Ministry of Land will communicate with Hyperledger network through the REST API.
  1. Mobile Verification Application – A QR code will be embedded on the document for the transaction of the land information and printed on the document when downloaded from Land Management system. Our mobile application will verify the authenticity of documents by scanning the QR code with our specialized mobile application. This mobile application will communicate with the REST API server too
  2. Web Verification Portal

There will be an online portal where any land information can be checked to verify the genuineness of the documents by filtering different fields. This portal will communicate with Hyperledger fabric network via REST API server. This filtering feature may also be added in any authorized site which people will believe e.g. Ministry of Land’s website, http://land.gov.bd website.

 

How does Hyperledger Fabric Work ?

Figure: Hyperledger Fabric work flow

  • A participant of Ministry of land invokes a transaction request through the client application.
  • Client application broadcasts the transaction invocation request to the Endorser peer.
  • Endorser peer checks the Certificate details and others to validate the transaction. Then it executes the Chaincode (ie. Smart Contract) and returns the Endorsement responses to the Client. Endorser peer sends transaction approval or rejection as part of the endorsement response.
  • The client now sends the approved transaction to the Orderer peer for this to be properly ordered and be included in a block.
  • Orderer node includes the transaction into a block and forwards the block to the Anchor nodes of different member Organizations of the Hyperledger Fabric network.
  • Anchor nodes then broadcast the block to the other peers inside their own organization. These individual peers then update their local ledger with the latest block. Thus all the network gets the ledger synced.

System Architecture of Blockchain Enabled Land Verification System 

Figure: System Architecture of Blockchain Enabled Land Verification System

Benefits of land registration/veriffication using Blockchain

  • Land selling/buying processing time can be reduced from months to few days.
  • Verification of ownership of land reduces to one/two steps as the information in blockchain is immutable and trustworthy.
  • Paperwork and postage cane be eliminated from the purchase process.
  • Fraud prevented because the buyer receives a pending property title, hence the property cannot be resold.
  • Chance of property title not being issued reduces significantly because all documents required by law are added to the blockchain.
  • Reduces manual intervention and realizing real-time property title assignment.
  • Digital signatures ensure high levels of security in the property transaction process.

Conclusion

We have real working experience of blockchain technology in both private and public blockchain platform. We believe that we that easily implement a prototype/minimum viable product (MVP) of Land Verification System using blockchain technology within short period of time.

Useful links for learning Digital Signature topic

Bouncy Castle

=>http://www.bouncycastle.org/wiki/display/JA1/X.509+Public+Key+Certificate+and+Certification+Request+Generation
=>http://www.programcreek.com/java-api-examples/index.php?api=org.bouncycastle.cert.X509v3CertificateBuilder

CSR READ and Write using bouncy-castle-in-java

=>https://stackoverflow.com/questions/10040977/unable-to-write-csr-generated-using-org-bouncycastle-asn1-pkcs-certificationrequ
=>https://stackoverflow.com/questions/14995711/getting-public-key-from-the-csr-file-using-bouncy-castle-in-java
=>https://www.programcreek.com/java-api-examples/index.php?api=org.bouncycastle.openssl.jcajce.JcaPEMWriter
Write x509 certificate into PEM formatted string in java?

Create CSR and Cert using bouncy-castle-in-java
=>https://stackoverflow.com/questions/7230330/sign-csr-using-bouncy-castle

Create PKCS10 request with subject alternatives using Bouncy Castle in Java and Subject DN
=>https://stackoverflow.com/questions/34169954/create-pkcs10-request-with-subject-alternatives-using-bouncy-castle-in-java
=>https://stackoverflow.com/questions/12863235/csr-generated-with-bouncycastle-missing-public-key-and-attributes

AFter all test code of bouncy castle-in-java
=>http://www.massapi.com/source/googlecode/57/34/5734022/jscep-read-only/src/test/java/org/jscep/message/PkiMessageEncoderTest.java.html#144

RDN
=>http://grepcode.com/file/repo1.maven.org/maven2/org.bouncycastle/bcprov-jdk15/1.46/org/bouncycastle/asn1/x500/style/BCStyle.java

=>http://awsomesoft.blogspot.com/2014/05/ccleaner-professional-full-with.htm

Things to learn for a blockchain developer

The overall concept is not so hard to understand. But as developer  you must  have a clear understanding on these if you want to be a blockchain developer:-


Blockchain: Like a global ledger or simple database of all transactions, the entire history of all transactions on the network.

Ethereum: is an open-source, public, blockchain-based distributed computing platform and operating system featuring smart contract functionality. This is not the only option there is platform like Hyperledger.

Miner: A node on the network that mines, i.e., works to process blocks on the blockchain.


Cryptocurrency : A cryptocurrency is a digital asset designed to work as a medium of exchange that uses cryptography to secure its transactions, to control the creation of additional units, and to verify the transfer of assets.

Wallet: A digital wallet is what it means, a wallet that stores coins or units of value on a file or in an application.

Smart contract: A smart contract is a computer protocol intended to digitally facilitate, verify, or enforce the negotiation or performance of a contract. Smart contracts allow the performance of credible transactions without third parties.

Solidity : Solidity is a contract-oriented programming language for writing smart contracts. It is used for implementing smart contracts on various blockchain platforms

DApp: A DApp has its backend code running on a decentralized peer-to-peer network. Contrast this with an app where the backend code is running on centralized servers.

Web3.js: It is like api in our traditional web app.  It is required to communicate with blockchain network from a Dapp.

 

The best way to map an Enum Type with table column in Spring and Hibernate

We often have to work using ENUM type in spring project. Let’s assume we have a Enum type – where A_PLUS is java variable type, “A+” is plain string to show in view page and 1 is the numeric value we want save in database.

[code language=”java”]

public enum BloodGroup {
public enum BloodGroup {
A_PLUS(1, “A+”), A_MINUS(2, “A-“);

private int value;
private String status;

private BloodGroup(int value, String status) {
this.value = value;
this.status = status;
}

public int getValue() {
return value;
}

public String toStr() {
return this.status;
}

public static BloodGroup valueOf(int value) {
for (BloodGroup v : values())
if (v.getValue() == value)
return v;
throw new IllegalArgumentException();
}
}
[/code]
Then our entity class is Author

[code language=’java’]
import java.util.*;

import javax.persistence.Column;
import javax.persistence.Convert;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.validation.constraints.NotNull;

import com.nea.bhrm.converter.BloodGroupToIntegerConverter;
import com.nea.bhrm.enums.BloodGroup;

@Entity
public class Author {
protected String name;
protected String email;
protected BloodGroup bloodGroup;

protected int id;

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getEmail() {
return email;
}

public void setEmail(String email) {
this.email = email;
}

@Id
@GeneratedValue(strategy = GenerationType.AUTO)
public int getId() {
return id;
}

public void setId(int id) {
this.id = id;
}

@Column(name = “blood_group”, nullable = false)
@Convert(converter = BloodGroupToIntegerConverter.class)
public BloodGroup getBloodGroup() {
return bloodGroup;
}

public void setBloodGroup(BloodGroup bloodGroup) {
this.bloodGroup = bloodGroup;
}
}

[/code]

We are using Blood Group type in the author class.

[code language=”java”]@Column(name = “blood_group”, nullable = false)
@Convert(converter = BloodGroupToIntegerConverter.class)[/code]

Here, column is defining the database table column of author table where the enum value will be saved and BloodGroupToIntegerConverter is converter responsible to convert enum to database and database to enum type that is A_PLUS -> 1 and 1 -> A_PLUS

Converter

[code language=”java”]
package com.nea.bhrm.converter;

import javax.persistence.AttributeConverter;

import com.nea.bhrm.employee.BloodGroup;

public class BloodGroupToIntegerConverter implements AttributeConverter {

@Override
public Integer convertToDatabaseColumn(BloodGroup bg) {
return bg.getValue();
}

@Override
public BloodGroup convertToEntityAttribute(Integer value) {
return BloodGroup.valueOf(value);
}

}
[/code]

Test:

[code language=”java”]
public class Main {
@Autowired
AuthorService authorService;

public static void main(String[] args) {
// Use annotated beans from the specified package

ApplicationContext ctx = new
AnnotationConfigApplicationContext(“com.nea.bhrm”);

Main main = ctx.getBean(Main.class);

Author author = new Author();
author.setEmail(“Bikash@gmail.com”);
author.setBloodGroup(BloodGroup.A_PLUS);
author.setName(“Bikash”);

main.authorService.save(author);

System.out.println(“ENUM name : ” + author.getBloodGroup().toString());
System.out.println(“ENUM value to print : ” + author.getBloodGroup().toStr());
System.out.println(“Actual Value at Database: ” + author.getBloodGroup().getValue());
}
[/code]

Output:


Hibernate:
insert
into
Author
(blood_group, email, name)
values
(?, ?, ?)
ENUM name : A_PLUS
ENUM value to print : A+
Actual Value at Database: 1

Database

enum

Difference between .p12(.pfx) vs .crt(.cer) vs .pem vs .der

PKCS#12 of .pfx or .p12PKCS#12 of .pfx or .p12

The PKCS#12 or PFX format is a binary format for storing the server certificate, any intermediate certificates, and the private key into a single encryptable file. PFX files are usually found with the extensions .pfx and .p12. PFX files are typically used on Windows machines to import and export certificates and private keys. The Personal Information Exchange format (PFX, also called PKCS #12) supports secure storage of certificates, private keys, and all certificates in a certification path. The PKCS #12 format is the only file format that can be used to export a certificate and its private key.

.CRT or .CER

CRT is a file extension for a digital certificate file used with a web browser. CRT files are used to verify a secure website’s authenticity, distributed by certificate authority (CA) companies such as GlobalSign, VeriSign and Thawte.

.PEM

PEM or Privacy Enhanced Mail is a Base64 encoded DER certificate. PEM certificates are frequently used for web servers as they can easily be translated into readable data using a simple text editor. Generally when a PEM encoded file is opened in a text editor, it contains very distinct headers and footers.The PEM extension is used for different types of X.509v3 files which contain ASCII (Base64) armored data prefixed with a “—– BEGIN …” line

.DER

DER files are digital certificates in binary format,  instead of the ASCII PEM format. … A DER file should not have any BEGIN/END statements and will show garbled binary content. Both digital certificates and private keys can be encoded in DER format. DER is often used with Java platforms.

Java: Bangla number to English and English number to bangla

A utility function to convert Bangla number to English and English number to bangla

English : 2015/12/29 21:10:23

Bangla : ২০১৫/১২/২৯ ২১:১০:২৩

[code language=”java”]
import java.util.HashMap;
import java.util.Map;

public class BanglaNumberToEnglish {
public static void main(String[] args) {
System.out.println(getDigitBanglaFromEnglish(“123”));
System.out.println(getDigitEnglishFromBangla(“১২৩”));
}

public static final String getDigitBanglaFromEnglish(String number) {
char[] banglaDigits = { ‘০’, ‘১’, ‘২’, ‘৩’, ‘৪’, ‘৫’, ‘৬’, ‘৭’, ‘৮’, ‘৯’ };

if (number == null)
return new String(“”);
StringBuilder builder = new StringBuilder();
try {
for (int i = 0; i < number.length(); i++) {
if (Character.isDigit(number.charAt(i))) {
if (((int) (number.charAt(i)) – 48) <= 9) {
builder.append(banglaDigits[(int) (number.charAt(i)) – 48]);
} else {
builder.append(number.charAt(i));
}
} else {
builder.append(number.charAt(i));
}
}
} catch (Exception e) {
// logger.debug("getDigitBanglaFromEnglish: ",e);
return new String("");
}
return builder.toString();
}

public static final String getDigitEnglishFromBangla(String number) {
Map banglaToEnglishDigitsMap = new HashMap();

banglaToEnglishDigitsMap.put(‘০’, ‘0’);
banglaToEnglishDigitsMap.put(‘১’, ‘1’);
banglaToEnglishDigitsMap.put(‘২’, ‘2’);
banglaToEnglishDigitsMap.put(‘৩’, ‘3’);
banglaToEnglishDigitsMap.put(‘৪’, ‘4’);
banglaToEnglishDigitsMap.put(‘৫’, ‘5’);
banglaToEnglishDigitsMap.put(‘৬’, ‘6’);
banglaToEnglishDigitsMap.put(‘৭’, ‘7’);
banglaToEnglishDigitsMap.put(‘৮’, ‘8’);
banglaToEnglishDigitsMap.put(‘৯’, ‘9’);

if (number == null)
return new String(“”);
StringBuilder builder = new StringBuilder();
try {
for (int i = 0; i < number.length(); i++) {
if (banglaToEnglishDigitsMap.containsKey(number.charAt(i))) {
builder.append(banglaToEnglishDigitsMap.get(number.charAt(i)));
} else {
builder.append(number.charAt(i));
}
}
} catch (Exception e) {
// logger.debug("getDigitBanglaFromEnglish: ",e);
return new String("");
}
return builder.toString();
}
}

[/code]

Web services implementation for beginners using SOAP

A WSDL is an XML document that describes a web service. It actually stands for Web Services Description Language.

SOAP is an XML-based protocol that lets you exchange info over a particular protocol (can be HTTP or SMTP, for example) between applications. It stands for Simple Object Access Protocol and uses XML for its messaging format to relay the information.

REST is an architectural style of networked systems and stands for Representational State Transfer. It’s not a standard itself, but does use standards such as HTTP, URL, XML, etc.

Sample wsdl:

http://www.holidaywebservice.com//HolidayService_v2/HolidayService2.asmx?wsdl

https://www.w3.org/2004/06/03-google-soap-wsdl.html

Tools

POSTMAN: http://blog.getpostman.com/2014/08/22/making-soap-requests-using-postman/

Firefox addon: http://automation-home.blogspot.com/2016/02/firefox-soa-client-plugin-for-web-services-testing.html

JAVA example

https://www.mkyong.com/webservices/jax-ws/jax-ws-hello-world-example-document-style/

https://www.javatpoint.com/jax-ws-example-document-style