2012-12-19 23:36:49 +07:00
How to add a new WebService in idempiere WebServices
2012-10-12 12:21:24 +07:00
i.e.
we're going to add a webservice to complete documents
the new webservice will have the following parameters:
2012-12-19 23:36:49 +07:00
* ADLoginRequest - it's already defined in WEB-INF/xsd/idempiere-schema.xsd with the following parameters:
2012-10-12 12:21:24 +07:00
user, pass, lang, ClientID, RoleID, OrgID, WarehouseID, stage
* TableName String -> M_InOut
* Record_ID int -> 1000002
* DocStatus String -> CO
2012-12-19 23:36:49 +07:00
Note, if you need to define new datatypes you need to define them in WEB-INF/xsd/idempiere-schema.xsd
and generate the idempiere-xmlbeans.jar again with this command:
2015-05-16 00:52:37 +07:00
2020-07-04 20:21:49 +07:00
scomp -out ./lib/idempiere-xmlbeans.jar ./WEB-INF/xsd/idempiere-schema.xsd
2015-05-16 00:52:37 +07:00
2012-10-12 12:21:24 +07:00
scomp will generate the corresponding classes to manipulate the xml objects from the messages
2015-05-16 00:52:37 +07:00
To install xmlbeans Git Clone URL: git://git.apache.org/xmlbeans.git
cd xmlbeans/
./xbeanenv.sh
ant
Environment example:
export XMLBEANS_HOME=/opt/xmlbeans
export PATH=$PATH:$XMLBEANS_HOME/bin
export XMLBEANS_LIB=$XMLBEANS_HOME/build/lib
export JAVA_HOME=/usr/lib/jvm/java-1.7.0...(your path)
Apps:
ant
svn
git
2012-10-12 12:21:24 +07:00
The method will be called modelSetDocAction - the model in name indicates that the web service is going to be based on model classes, current web services are based in UI instead of model.
So, we add this line:
2012-12-19 23:36:49 +07:00
public StandardResponseDocument modelSetDocAction(String tableName, int recordID, String newDocStatus, ADLoginRequestDocument reqlogin);
at the interface WEB-INF/src/org/idempiere/adinterface/ADService.java
2012-10-12 12:21:24 +07:00
NOTE: In parameters, complex data must be at the end
Now, we need to implement the method, so we open the file
2012-12-19 23:36:49 +07:00
WEB-INF/src/org/idempiere/adinterface/ADServiceImpl.java
2012-10-12 12:21:24 +07:00
And add the new method and define the corresponding logic within.