core-jgi/org.idempiere.webservices/Notes/HowToAddNewWebService.txt

50 lines
1.7 KiB
Plaintext
Raw Normal View History

2012-12-19 23:36:49 +07:00
How to add a new WebService in idempiere WebServices
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:
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:
2012-12-19 23:36:49 +07:00
scomp -out ./WEB-INF/lib/idempiere-xmlbeans.jar ./WEB-INF/xsd/idempiere-schema.xsd
scomp will generate the corresponding classes to manipulate the xml objects from the messages
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
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
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
And add the new method and define the corresponding logic within.