Tuesday, June 11, 2024

Using Batik Library for SVG to PNG Conversion in Software AG Integration Server

 

Prerequisites:

  1. Ensure you have the necessary JAR files for Apache Batik and its dependencies.
  2. The JAR files must be placed in the code/jars directory of your Integration Server package.

Required JAR Files:

Ensure you have the following JAR files:

  • batik-all-1.9.jar
  • xalan-2.7.2.jar
  • commons-logging-1.2.jar
  • commons-io-2.8.0.jar
  • xmlgraphics-commons-2.2.jar
to avoid any error copy all downloaded JARs into folder code/jars in the package

Steps to Integrate Batik Library

  1. Download JAR Files:

    • You can manually download the required JAR files from this link https://archive.apache.org/dist/xmlgraphics/batik/source/batik-src-1.9.zip
  2. Place JAR Files in Integration Server:

    • Copy the downloaded JAR files to the code/jars directory of your Integration Server package.
           

  1. Restart Integration Server (Optional):

    • Restart the Integration Server to load the new libraries.

Java Service Code for SVG to PNG Conversion

Ensure your Java service is correctly set up to use the Batik library. Here's the code:


import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.OutputStream; import org.apache.batik.transcoder.TranscoderInput; import org.apache.batik.transcoder.TranscoderOutput; import org.apache.batik.transcoder.image.PNGTranscoder; import com.wm.data.IData; import com.wm.data.IDataCursor; import com.wm.data.IDataUtil; import com.wm.app.b2b.server.ServiceException; public static final void convertSVGToPNG(IData pipeline) throws ServiceException { // Retrieve input parameters from the pipeline IDataCursor cursor = pipeline.getCursor(); String svgFilePath = IDataUtil.getString(cursor, "svgFilePath"); String pngFilePath = IDataUtil.getString(cursor, "pngFilePath"); cursor.destroy(); if (svgFilePath == null || pngFilePath == null) { throw new ServiceException("Input parameters 'svgFilePath' and 'pngFilePath' are required."); } FileInputStream inputStream = null; FileOutputStream outputStream = null; try { // Create a transcoder instance PNGTranscoder transcoder = new PNGTranscoder(); // Set the input File svgFile = new File(svgFilePath); inputStream = new FileInputStream(svgFile); TranscoderInput input = new TranscoderInput(inputStream); // Set the output File pngFile = new File(pngFilePath); outputStream = new FileOutputStream(pngFile); TranscoderOutput output = new TranscoderOutput(outputStream); // Perform the transcoding transcoder.transcode(input, output); } catch (Exception e) { throw new ServiceException("Error converting SVG to PNG: " + e.getMessage(), e); } finally { try { if (inputStream != null) inputStream.close(); if (outputStream != null) { outputStream.flush(); outputStream.close(); } } catch (Exception e) { // Log the error if any e.printStackTrace(); } } }

Test the Service

  1. Create a Flow Service:

    • Create a flow service that calls the convertSVGToPNG Java service.
    • Map the input parameters (svgFilePath and pngFilePath).
  2. Execute the Flow Service:

    • Run the flow service and check if the PNG file is generated correctly.

By following these steps, you should be able to convert SVG files to PNG using the Batik library in Software AG Integration Server without encountering the WriteAdapter error. If you face any issues, ensure that all dependencies are correctly placed and the server is properly restarted.

Monday, May 20, 2024

Configure JDBC connection with Microsoft SQL Server (Integration Server 10.7)

Connection  to MSSQL database is not out of box feature .To apply it first you need to download the JDBC Driver jar from Microsoft site  then you need add it under lib folder and restart the server . 

Lib Path is : C:\yourSAGHome\IntegrationServer\instances\default\lib\jars

After the restart the server will be able to load the new jar and make it available for future use .

Steps in Details

1- 


2-Unzip the file then copy file mssql-jdbc-11.2.3.jre8 to the following paths (in each integration server node) .

        C:\yourSAGHome\IntegrationServer\lib C:\yourSAGHome\IntegrationServer\instances\default\lib\jars

3-Restart the server 4-login to the server and go to Adapters –> webMethods Adapter for JDBC --> 5- click Configure New Connection link then choose webMethods Adapter for JDBC Connection

6-fill configuration details :   

               


                                            
7-Click test connection and enable connect


Enjoy Your SQL Connection !


Sunday, May 19, 2024

Fix issue : Unable to locate or start compiler in webmethod integration server 10.7

In some cases when we try to compile java service using save the following error are showing up :

The source was saved, but was not compiled due to the following errors:

com.wm.app.b2b.server.ServiceException: [ISS.0014.9116] Unable to locate or start compiler



 Resolution : 
Remove the command watt.server.compile=C:\sag107\jvm\jvm\bin\javac -classpath {0} -d {1} {2} from extended settings to enforce use default compiler



Reference :

watt.server.compile
Specifies the compiler command that Integration Server uses to compile Java services that are developed using
Designer

, For example, javac -classpath {0} -d {1} {2}This compiler command is also used from the jcode utility. If this property is omitted or empty, the server uses the JVM internal Java compile tool to compile Java services.

Thursday, January 11, 2018

Exception : this is only psuedo object

Today , i have faced this error when i try to deploy SOA composite to the server from jdeveloper . where the deployment process is failed and i have received this exception in the jdeveloper window log , to overcome this issue i did some searches to find out solution and i found useful link here .

In the above link it suggest that reason of this error is the mismatch between WSDL url in composite and BPEL where one is pointing to server while other to MDS .

however, in my case the problem was removing SOAP component from composite without removing the in\out variables of Invoke after removing the INOKE itself .

when i deleted the variable everything worked and the composite is deployed .  

Saturday, July 22, 2017

Consuming SSL Web service with certificate using oracle SOA 12c

lately , we have received WSDL from client with SSL and certificate and we try to consume this  web service we have faced the following exception :

javax.xml.ws.WebServiceException: javax.net.ssl.SSLKeyException: Hostname verification failed

we quick solve this issue by the following steps :

Servers -> server name -> Configuration SSL tab -> Advanced -> Change Hostname Verification dropdown to None

then we face this exception :
sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
our understand was , we need to import certificate into weblogic keystror and  to do that we went to keystrore tab in weblogic to get the path of trust store and we surprised because the concept in 12c is different about 11g . in 11g you will see physical paths while in 12c became urls .

after some research we understood that we have to add the certificate to system\trust keystore from em



but the error did not change so we back to 11g concept and we try . the steps as follow :


  • create key store using keytool
  • import Root,intermediate,client certificate to this key store
  • adding this commands to file set domainenv                                                                                        set JAVA_OPTIONS=%-Djavax.net.ssl.trustStore=fullpath -Djavax.net.ssl.trustStorepassword=yourpassword
  • restart weblogic
and that's all !

Note : after we finish this solution we discovered oracle link that may help to solve first solution issue by the following :


  1. Open FMW_HOME/user_projects/domains/WLS_SOA/bin/setDomainEnv.sh.
  2. In EXTRA_JAVA_PROPERTIES:
    Replace:
    • -Djavax.net.ssl.trustStore=%WL_HOME%\server\lib\DemoTrust.jks
    With:
    • -Djavax.net.ssl.trustStore=kss://system/trust -Djavax.net.ssl.trustStoreType=kss

but i did not try it so i strongly advice to try this first before go to 11g approach .


Note2 : a i did not include keytool commands to create keystore and import certificate because it's available everywhere .



finally , i would like to thank my colleague Mohannad click here for his support .






Saturday, February 18, 2017

Integration with Knet Payment Gateway - Pin Pad Device

in this article series i will suggest way to control Pinpad Device (payment through device) from ADF application . the story started when we received java Api (jar) from knet payment Gateway (Kuwait payment gateway ) , with target to implement it through ADF application .

first approach was implementing it using java applet which not worked because java Applet became out dated . we looked to alternative solutions but we failed .

later , we found implementation using windows service (hosting Wcf over windows Service) but the challenge still exist because we don't have dll . so we converted the jar to dll .  

the proposed solution have the following steps :

  1. Convert jar to dll (to convert library from java technology to .net)
  2. develop WCF Service (rest) over windows 
  3. import the Dll and execute the payment process through web operation
  4. run and start windows Service
  5. call the service from java script
Below the details :

conversion library from jar to dll :
we searched a lot to find the appropriate too to do this task . until we found ikvm tool which enable you to convert your jars to dlls and exe (check this)  after downloading and unzipping it you can execute this task using the following command line :

ikvmc your jar.jar

after execution you will find your dll in the same directory , did you find it ? good job 😏
now let us go to the next step .

 Hosting WCF on windows service :
this approach suggested by Microsoft to host web services on end user PC with full privileges to access user resources and hardware check this.

  Create java script Caller :

in this part i will show how to create java script code that should be used to call Rest service that hosted on ADF application  . below sample for it .

<script type="text/javascript">
       function test() 
             {
                var xhttp = new XMLHttpRequest();
                xhttp.open("POST", "http://localhost:8000/ServiceModelSamples/service/knetPayment",                     true) ;
               xhttp.setRequestHeader("Content-type", "application/json");
               
                xhttp.onload = function (e) 
                   {
                      if (xhttp.readyState === 4) 
                           {
                              if (xhttp.status === 200) 
                                       {
                                           alert(xhttp.responseText);
                                        } 
                              else 
                                        {
                                           alert(xhttp.statusText);
                                         }
                               }
                     };
              xhttp.onerror = function (e) 
                    {
                       alert(xhttp.responseText);
                    };
              xhttp.send('{"Amount":"10"}');
              alert("3");
           
         }



    </script>


Enjoy !

Wednesday, November 23, 2016

Create OID User using java SDK

in this article i gonna show java code sample that explain how to create user in OID grammatically .
before taking the code you have to do the following two steps :

  1. Create custom project 
  2. add reference for the following jar ldapjclnt11
now Create Class and copy the following code :


import oracle.ldap.util.*;
import oracle.ldap.util.jndi.*;
import javax.naming.NamingException;
import javax.naming.directory.*;
import java.io.*;
import java.util.*;





public class OIDConnect {
    public OIDConnect() {
        super();
    }
    
    final static String ldapServerName = "xx.xx.xx.xx";
    final static String ldapServerPort = "3060";
    final static String rootdn = "cn=orcladmin";
    final static String rootpass = "password";


    public static void main(String[] args) throws NamingException {
       
       
        // Create the connection to the ldap server
        InitialDirContext ctx = ConnectionUtil.getDefaultDirCtx(ldapServerName, ldapServerPort, rootdn, rootpass);

        // Create the subscriber object using the default subscriber
        Subscriber mysub = null;
        String[] mystr = null;
       
        try 
            {
                RootOracleContext roc = new RootOracleContext(ctx);
                mysub = roc.getSubscriber(ctx, Util.IDTYPE_DN, "dc=xx,dc=xx,dc=xx", mystr);
                              
            
              
            } 
        catch (UtilException e) {
            e.printStackTrace();
        }

        // Create ModPropertySet 
        ModPropertySet mps = new ModPropertySet();
        
        
        mps.addProperty(LDIF.ATTRIBUTE_CHANGE_TYPE_ADD, "cn", "John");
        mps.addProperty(LDIF.ATTRIBUTE_CHANGE_TYPE_ADD, "sn", "John");
        mps.addProperty(LDIF.ATTRIBUTE_CHANGE_TYPE_ADD, "objectclass", "person");
        mps.addProperty(LDIF.ATTRIBUTE_CHANGE_TYPE_ADD, "objectclass", "organizationalPerson");
        mps.addProperty(LDIF.ATTRIBUTE_CHANGE_TYPE_ADD, "objectclass", "inetOrgPerson");
        mps.addProperty(LDIF.ATTRIBUTE_CHANGE_TYPE_ADD, "objectclass", "orclUser");
        mps.addProperty(LDIF.ATTRIBUTE_CHANGE_TYPE_ADD, "objectclass", "orclUserv2");
        
        mps.addProperty(LDIF.ATTRIBUTE_CHANGE_TYPE_ADD, "givenname", "John");
        mps.addProperty(LDIF.ATTRIBUTE_CHANGE_TYPE_ADD, "userPassword", "xxx");
        mps.addProperty(LDIF.ATTRIBUTE_CHANGE_TYPE_ADD, "uid", "John");

        // Create the user
        User newUser = null;
        try {
            newUser = mysub.createUser(ctx, mps, false);
            
        
            System.out.println("New User DN: " + newUser.getDN(ctx));
        } catch (UtilException e) {
            e.printStackTrace();
        }
    }


      
        
   
}