ERP 2.50:Developers Guide/Code Snippets/SOAP WebService
ERP 2.50:Developers Guide |
|
Adding Field to a Web service
- Make sure database has the column for the field you want to add.
- You might want to add the field also to Openbravo's equivalent window tab. (I won't go through these procedures, just a mention that field needs to be in database as well in order to work properly.)
- Modify the sqlclass to have the field in question, if fetching information from openbravo it needs to be processed in SELECT clause, if sending to openbravo in INSERT.
- Modify the class to have proper variable and get/set functions for the field in question.
- Modify ExternalSalesImpl to handle the data within method.
- stop Tomcat, compile, start Tomcat and install web service, in this order
Example:
Goal: to add SKU field in getProductsCatalog method within Product array.
- Database has SKU already stored in M_PRODUCT.SKU
- Field wasn't made active in default installation, so I added it to Product Tab through System administration.
- Modify ExternalSalesProduct_data.xsql file to fetch sku data from database, add M_PRODUCT.SKU AS SKU, for example after M_PRODUCT.UPC AS EAN,
- Modify Product.java file to have variable and functions for sku, add the following:
private String sku; public String getSku() { return sku; } public void setSku( String sku ) { this.sku = sku; }
5. Modify ExternalSalesImpl.java file to add the correct data to correct variable:
add products[i].setSku(data[i].sku); after products[i].setEan(data[i].ean); in method: public Product[] getProductsCatalog
6. stop Tomcat, compile, start Tomcat and install web service, in this order
Thanks to Aarne Salminen to write this example in this post.
Languages: |
ERP 2.50:Developers Guide/Code Snippets | ERP 2.50:Developers Guide/Code Snippets/Report