IT Certificaions

Google Cloud Platform

Tuesday, August 8, 2017

Thursday, May 25, 2017

Create java client from WSDL for Google App engine

This post will explain how to consume SOAP based web services on Google App Engine platform.

  1. Keep your wsdl files in resources/wsdl folder
  2. Make these files entry in appengine-web.xml like
  3.   <static-files>
           <include path="/**.wsdl"/>
         <include path="/**.WSDL"/>
  4.  Now update POM file for wsdl to java plugin

Now you can use maven commands mvn clean install and stubs will be generated in and packages.

Convert pfx file into jks using java

This is a post which shows how to convert pfx file into jks.

Prerequisites : Java 6+
Step 1: Use cmd with java in your classpath

keytool -importkeystore -srckeystore testKey.pfx -srcstoretype pkcs12 -srcalias <myAliasName>
 -destkeystore jksFile -deststoretype jks -deststorepass password -destalias <alias>

Java Client with certificate authentication to access SOAP Webservice

This is an example to explain  how to authenticate java stub client with certification and send request to SOAP WSDL.

public static void applyCertificateAuthentication(MyWsdlDataRequest wsdlClientRequest)
            throws Exception {

       String keyStoreLocation="resources/keys/testKey.jks";

       String password="key@12345";
        ClassLoader classLoader = this.class.getClassLoader();
        InputStream keyInputStream = classLoader.getResourceAsStream(keyStoreLocation);

        SSLContext sc = SSLContext.getInstance("SSLv3");
        KeyManagerFactory factory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
        KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
        keyStore.load(keyInputStream, password.toCharArray());
        factory.init(keyStore, password.toCharArray());
        sc.init(factory.getKeyManagers(), null, null);

        MyWsdlService serviceImpl = new MyWsdlService ();
       MyWsdlDataStub servicePort = serviceImpl.getPort(MyWsdlDataStub .class);               BindingProvider bp = (BindingProvider) servicePort;

((BindingProvider) servicePort).getRequestContext().put("",

 MyWsdlDataResponse response = servicePort.siSaveSocDataOut(wsdlClientRequest);