Posts

Showing posts from May, 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. Keep your wsdl files in resources/wsdl folder Make these files entry in appengine-web.xml like   <static-files>        <include path="/**.wsdl"/>      <include path="/**.WSDL"/>  </static-files>  Now update POM file for wsdl to java plugin  <plugin>     <groupId>org.apache.cxf</groupId>     <artifactId>cxf-codegen-plugin</artifactId>     <version>3.0.1</version>     <executions>         <execution>             <id>generate-sources</id>             <phase>generate-sources</phase>             <configuration>                              <sourceRoot>${basedir}/src/main/java</sourceRoot>                 <wsdlOptions>                     <wsdlOption>                           <wsdl>src/main/resources/wsdl/ReadData.wsdl</wsdl>  

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 MyWsdlSer