How to resolve Connection Reset for SOAP/REST calls in SOAP-UI

If we are getting “Connection Reset” (ERROR:java.net.SocketException: Connection Reset) at endpoint URL which is TLS 1.2 enabled then we could follow given below steps for necessary tuning:-

(1) Navigate to C:\Program Files\SmartBear\SoapUI-5.2.1\bin folder.

(2) Edit SoapUI-5.2.1.vmoptions file with any text editor.

(3) Add following entry and save the file and restart SOAP-UI.

-Dsoapui.https.protocols=SSLv3,TLSv1.2
Advertisements

AWS DevOps

DevOps is a popular and efficient implementation of the software development lifecycle, making AWS DevOps a highly popular amalgamation. Given below are few key-points which could be referenced for the same:-

  • AWS CloudFormation:- It enables DevOps teams to create and release cloud instances and services more frequently than traditional development teams. Templates of AWS resources like EC2 (Elastic Compute Cloud) instances, ECS (Elastic Container Service) containers, and S3 (Simple Storage Service) storage buckets let you set up the entire stack without you having to bring everything together yourself.
  • AWS EC2:- You can run containers inside EC2 instances, so you can leverage the AWS Security and management features.
  • AWS CloudWatch:- This monitoring tool lets you track every resource that AWS has to offer. Plus it makes it very easy to use third-party tools for monitoring.
  • AWS CodePipeline:- It is one of the popular feature from AWS which simplifies the way you manage your CI/CD toolset. It lets you integrate with tools like GitHub, Jenkins, and CodeDeploy, enabling you to visually control the flow of app updates from build to production.

How to configure H2 Database in Spring Boot

Usually, we configure the H2 database in the web.xml file as a Servlet, but Spring Boot is using an embedded instance of Tomcat, so we don’t have access to the web.xml file. Spring Boot does provide us a mechanism to use for declaring servlets via a Spring Boot ServletRegistrationBean.

The following Spring Configuration declares the Servlet wrapper for the H2 database console and maps it to the path of /h2Console.

@Configuration
public class WebConfiguration {
	@Bean
	ServletRegistrationBean h2servletRegistration() {
		ServletRegistrationBean registrationBean = new ServletRegistrationBean(new WebServlet());
		registrationBean.addUrlMappings("/h2Console/*");
		return registrationBean;
	}
}

SOLID Principles

The SOLID principles were first conceptualized by Robert C. Martin and later built upon by Michael Feathers, who introduced us to “SOLID” acronym. As per their study, design principles encourage us to create more maintainable, understandable, and flexible software. Therefore, as our applications grow in size, we can reduce it’s complexity and better management.

Following are the SOLID principles for each developer/architect reference:-

  • Single Responsibility:- This principle states that a class should have only one responsibility and one reason to change. Once acheived, following are the benefits for the same:-
    • Testing – A class with one responsibility will have fewer test cases
    • Loose Coupling – Less functionality in a single class will have fewer dependencies
    • Organized – Smaller, well-organized classes are easier to search than monolithic ones
  • Open/Closed:- Following principle states that classes should be open for extension, but closed for modification. In doing so, we stop ourselves from modifying existing code and causing potential new bugs. By extending the Parent class we can be sure that our existing application won’t be affected.
  • Liskov Substitution:- Functions that use references to base classes must be able to use objects of the derived class without knowing it. In simple words, derived classes must be substitutable for the base class. It’s recommended to call public parent methods to get your results in the sub-classes and not directly using the internal variables. That way you are making sure the parent abstractions get to the required state without side effects or invalid state transitions. It’s also recommended keeping your base Abstractions as simple and minimal as possible, making it easy to extend by the sub-classes.
  • Interface Segregation:- Larger interfaces should be split into smaller ones. By doing so, we can ensure that implementing classes only need to be concerned about the methods that are of interest to them.
  • Dependency Inversion:- The principle of Dependency Inversion refers to the decoupling of software modules. This way, instead of high-level modules depending on low-level modules, both will depend on abstractions.

How Spring and Spring Boot Bootstraps Works?

Spring supports both the legacy web.xml way of bootstrapping as well as the latest Servlet 3+ method.

  • Approach using web.xml
    • Servlet container reads web.xml file and DispatcherServlet defined in the web.xml is instantiated by the container
    • DispatcherServlet creates WebApplicationContext by reading WEB-INF/{servletName}-servlet.xml
    • Finally, DispatcherServlet registers the beans defined in the application context
  • Approach using Servlet 3+
    • Container searches for classes implementing ServletContainerInitializer and executes
    • SpringServletContainerInitializer finds all classes implementing WebApplicationInitializer
    • WebApplicationInitializer creates the context with XML or @Configuration classes and further creates DispatcherServlet

Spring Boot uses an embedded servlet container to run an application using a class which is annotated with @SpringBootApplication. In this case, Spring Boot uses the public static void main entry-point to launch an embedded web server which takes care of binding of the Servlet, Filter and ServletContextInitializer beans from the application context.

@SpringBootApplication
public class MyApplication {
    public static void main(String[] args) {
        SpringApplication.run(MyApplication.class, args);
    }
}

Spring Boot also provides the option of deploying it as a web archive in an external container and for this we have to extend the SpringBootServletInitializer. Here, the external servlet container looks for the Main-class defined in the META-INF file of web archive and the SpringBootServletInitializer will take care of binding the Servlet, Filter, and ServletContextInitializer.

@SpringBootApplication
public class Application extends SpringBootServletInitializer {
    ...
    ...
}

Happy Learning !!

What is Spring and Spring Boot?

Spring provides Dependency Injection and out of the box modules which can drastically reduce the development time of an application. Few of the modules are given below:-

    • Spring MVC
    • Spring JDBC
    • Spring Security
    • Spring AOP
    • Spring ORM

Spring Boot is an extension of Spring framework which eliminates the boilerplate configurations required for setting up a Spring application. Few of the features in Spring Boot are given below:-

    • Starter dependencies for fast development
    • Automatic configurations to simplify build and deployment
    • Embedded server to avoid complexity in application deployment
    • Metrics, Health check and externalized configurations

What is TypeScript?

TypeScript is a superset to JavaScript, which means, that it compiles into pure JavaScript in the end. It provides “Strong Typing” (that’s where the name comes from). This means that we can (and should) assign types to our variables and class members. These types won’t compile to JavaScript (as JS does not know types) but we will get compilation errors if we assign wrong types or make any other type-related errors. This is a huge help in the daily development work and should not be underestimated.

In additon to this, TypeScript introduces some nice features, JavaScript does not have out of the box (at least in the ES5 specification). This includes classes (‘class’ keyword), interfaces, generics and modules. Being able to use these constructs makes our code cleaner, easier to read and helps us avoid nasty errors. Especially in combination with the strong typing we are really able to write high quality code and track down errors quickly.

Happy Learning, Code Look-Up @ GitHub Repository:- https://github.com/vinaychauhan-java/Programming_TypeScript.git