Skip to Content

How do I configure a Java Call Atom in B1if

Hi,

I need some help in configuring my Java call atom. It seems I am not able to get the correct qualified classname.

The jar file has been put in the folder ..\Tomcat\webapps\B1iXcellerator\WEB-INF\lib (code of the only contained file below)

No matter what I enter as Java Class Name, I keep on getting this error:

com.sap.b1i.bizprocessor.BizProcException: BPE027 Could not obtain instance of 'Callable' class Further details: className: main/Test

Is there anything I am missing in the configuration?

Thanks a lot

package main;

import java.sql.Connection;
import java.util.Properties;

import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

import com.sap.b1i.bizprocessor.BizProcMessage;
import com.sap.b1i.bizprocessor.BizProcMessageWithBSA;
import com.sap.b1i.bizprocessor.BizStoreAccessor;
import com.sap.b1i.bizprocessor.Callable;

public class Test implements Callable {
    private int level = 0; 
    
    public Test() {
    
    }
    @Override
    public boolean call(Properties inProps, BizProcMessage inMsg, Properties outProps, BizProcMessage outMsg, Connection conn, String jobID) throws Exception {
        if(inMsg != null && inMsg instanceof BizProcMessageWithBSA) {
            BizProcMessageWithBSA bpmbsa = (BizProcMessageWithBSA) inMsg;
            BizStoreAccessor bsa = bpmbsa.getAccessor ();
            fillProperties(outProps, bpmbsa.getXMLDOMPayload(bsa));
        }
        return false;
    }
    
    private void fillProperties(Properties prop, Document document) {
        NodeList list = document.getChildNodes();
        for (int i = 0; i < list.getLength(); i++) {
            iterateNode(prop, list.item(i));
        }
    }
    private void iterateNode(Properties prop, Node n) {
        level++;
        if(n.getNodeName()!=null&&n.getNodeName().length()>0) {
            prop.setProperty(n.getNodeName(), "level: "+level+" value: "+n.getNodeValue());
        }
        NodeList list  =    n.getChildNodes();
        for (int i = 0; i < list.getLength(); i++) {
            iterateNode(prop, list.item(i));
        }
        level--;
    }

    @Override
    public boolean isThreadSafe() {
        return false;
    }

    @Override
    public void mustDestroy() {
        
    }

    @Override
    public boolean usesJDBC() {
        return false;
    }
}
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Jan 31 at 08:29 AM

    Hi,

    can you give us some atom config informations?
    The Java Class name must be the fully qualified class name. Keep in mind that the jar file must be available in the integration framework base directory.

    Add comment
    10|10000 characters needed characters exceeded

    • As far as I know, the base directory should be this one:

      D:\Program Files (x86)\SAP\SAP Business One Integration\IntegrationServer\Tomcat\webapps\B1iXcellerator\WEB-INF\lib

      Since a lot of other B1i jars are found here, this should be right.

      The relevant configuration of the java atom is this:

      Java Class Name*: #main/Test
      SysId*: #
      Input*: #atom2/root/Payload
      Parameter*: #

      If needed, I can attach the jar and/or the full scenario

  • Feb 20 at 12:15 PM

    I found my error:

    In the configuration of the java atom, I wrote

    #main/Test

    as Java Class Name, instead it had to be

    #main.Test

    such a small error...

    Add comment
    10|10000 characters needed characters exceeded

  • May 30 at 07:07 AM

    Hello,

    There are different ways to call Java Class.

    You may use call Java atom, or use xsl code.

    What you mentioned is using Call Java Atom.


    Here is an example for using call java in xsl code.

    Java code:

    public class AddClass
    {
    	public static long Add(long i,long j)
    	{
    		return (i + j);
    	}
    }
    


    XSL code:

    <xsl:template xmlns:myClient="com.sap.b1i.MyClient.AddClass" name="transform">
    	<AddResult>
    		<x>123</x>
    		<y>234</y>
    		<Result>
    			<xsl:value-of select="myClient:Add(123,234)"/>
    		</Result>
    	</AddResult>
    </xsl:template>
    

    Thanks & best regards

    Huan Yang

    Add comment
    10|10000 characters needed characters exceeded