Skip to content

Instantly share code, notes, and snippets.

View rajeevshukla's full-sized avatar
🎯
Focusing

Rajeev Shukla rajeevshukla

🎯
Focusing
View GitHub Profile
@rajeevshukla
rajeevshukla / AxisHandler.java
Created October 14, 2018 23:05
Registering Axis handler
import org.apache.axis.AxisFault;
import org.apache.axis.AxisFault;
import org.apache.axis.Message;
import org.apache.axis.MessageContext;
import org.apache.axis.handlers.BasicHandler;
import org.apache.axis.utils.Messages;
public class AxisLogHandler extends BasicHandler {
private static final long serialVersionUID = 1L;
@Override public void invoke(MessageContext msgContext) throws AxisFault {
try {
@rajeevshukla
rajeevshukla / ApplicationUtils.java
Created October 14, 2018 23:09
Configuring Simple Provider
private static SimpleProvider configureAxisLogger() {
SimpleProvider clientConfig = new SimpleProvider();
AxisLogHandler logHandler = new AxisLogHandler();
SimpleChain reqHandler = new SimpleChain();
SimpleChain respHandler = new SimpleChain();
reqHandler.addHandler(logHandler);
respHandler.addHandler(logHandler);
Handler pivot = new HTTPSender();
Handler transport = new SimpleTargetedChain(reqHandler, pivot, respHandler);
clientConfig.deployTransport(HTTPTransport.DEFAULT_TRANSPORT_NAME, transport);
@rajeevshukla
rajeevshukla / Main.java
Created October 14, 2018 23:11
Main class
public static void main(String[] args) {
SimpleProvider clientConfig = ApplicationUtils.configureAxisLogger();
try {
XYZLocator dataUtilizationLocator = new XYZLocator("WSDL LOCATION", "Qname");
dataUtilizationLocator.setEngineConfiguration(clientConfig);
dataUtilizationLocator.setEngine(new AxisClient(clientConfig));
XYZSoap xyzSoap = dataUtilizationLocator.getXYZSoap();
xyzSoap.getDataFromService();
} catch (Exception e) {
e.printStrackTrace();
@rajeevshukla
rajeevshukla / Employee.java
Last active October 15, 2018 12:24
Employee class
public class Employee {
private int id;
private String firstName;
private String lastName;
private int age;
private String email;
private float salary;
//considering an employee can have multiple cars
private List<Car> cars;
@rajeevshukla
rajeevshukla / Car.java
Created October 15, 2018 12:26
Car details
public class Car {
private Integer id;
private String make;
private String model;
private String color;
private Integer year;
private Double price;
//Getters & Setters omitted.
@rajeevshukla
rajeevshukla / pom.xml
Created October 15, 2018 12:29
pom.xml
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>22.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
@rajeevshukla
rajeevshukla / MockDataUtils.java
Created October 15, 2018 12:31
Load Json files and convert that into java object using libraries
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.io.IOUtils;
import com.google.common.collect.ImmutableList;
import com.google.common.io.Resources;
<dependency>
<groupId>com.github.ulisesbocchio</groupId>
<artifactId>jasypt-spring-boot-starter</artifactId>
<version>2.0.0</version>
</dependency>
@rajeevshukla
rajeevshukla / encrypt.txt
Last active December 13, 2018 21:59
Encrypting database password with secret key
<user_home>\.m2\repository\org\jasypt\jasypt\1.9.2>java -cp jasypt-1.9.2.j
ar org.jasypt.intf.cli.JasyptPBEStringEncryptionCLI input="Tgi$912" password=vo
ipsecretz algorithm=PBEWithMD5AndDES
----ENVIRONMENT-----------------
Runtime: Oracle Corporation Java HotSpot(TM) 64-Bit Server VM 25.181-b13
<dependency>
<groupId>com.github.ulisesbocchio</groupId>
<artifactId>jasypt-spring-boot-starter</artifactId>
<version>2.1.0</version>
</dependency>