1

I need to call Idempiere Business Modules (ex. Creating Purchase Order process) , not tables via a web services, Is there any way to do this without going through the source code of Idempiere, I don't want to use RESTful methods that will deal with tables directly

Yosra Galal
  • 316
  • 2
  • 10

2 Answers2

2

You are probably referring to improvements on iDempiere's Web Services where composite (master-detail) and CRUD actions are now possible. Complete description at the project wiki: http://wiki.idempiere.org/en/NF1.0_Web_Services_Improvements Below I paste results of https://test.idempiere.org/ADInterface/services

Available SOAP services: CompositeService

compositeOperation

Endpoint address: http://test.idempiere.org/ADInterface/services/compositeInterface

WSDL : {http://idempiere.org/ADInterface/1_0}compositeInterface Target namespace: http://idempiere.org/ADInterface/1_0 ModelADService

setDocAction
createUpdateData
getList
readData
createData
runProcess
queryData
deleteData
updateData

Endpoint address: http://test.idempiere.org/ADInterface/services/ModelADService

WSDL : {http://idempiere.org/ADInterface/1_0}ModelADService Target namespace: http://idempiere.org/ADInterface/1_0

Available RESTful services: Endpoint address: http://test.idempiere.org/ADInterface/services/rest WADL : http://test.idempiere.org/ADInterface/services/rest?_wadl

red1
  • 120
  • 5
0

You can use create a provide service interface from org.adempiere.base plugin, invoke this service inside your code and invoke the constructor for class MOrder extends X_C_Order and for class MOrderLine extends X_C_OrderLine.

Here you have the example from IProcessFactory (you can create your factory like ICreateOrderFactory , or just IInsertFactory ( for a generic factory constructor you can set the table id ) :

This is a interface declaration

public interface IProcessFactory {
    /**
     * Create new process instance
     * @param className
     * @return new process instance
     */
  public ProcessCall newProcessInstance(String className);
    }

This is a evocation method

    public class ProcessFactory implements IProcessFactory {
    @Override
    public ProcessCall newProcessInstance(String className) {
        if (className.equals("com.com.nexus.webservice.client.process.IntegratorWS"))
            return new IntegratorWS();
        else
            return null;
    }
}

Now you need to create .xml of this factory like that : (pay attention in provided interface)

<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="com.nexus.integrator.ProcessFactory">
<implementation class="com.nexus.webservice.client.process.ProcessFactory"/>
<property name="service.ranking" type="Integer" value="5"/>
<service>
<provide interface="org.adempiere.base.IProcessFactory"/>
</service>
</scr:component>

To use this in OSGI architecture, you need to configure your MANIFEST file to import this Service-Component: ( I always use osgi-inf directory for my factories xml)

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: com.nexus.webservice.client
Bundle-SymbolicName: com.nexus.webservice.client;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: Macrosoftware
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: org.adempiere.base

Service-Component: OSGI-INF/ProcessFactory.xml

Import-Package: org.osgi.framework

You can do this , or you can use composite webservice .
I consider the second most safe and effective method

Arthur Melo
  • 454
  • 5
  • 13