Log in / create account
View source | Discuss page | Page history | Printable version   
ADVERTISEMENT
Accounting eLearning Courses
Partnerships
SourceForge.net Logo
Openbravo ERP at SourceForge

SourceForge.net Logo
Openbravo POS at SourceForge

Open Solution Alliance Logo
Openbravo at Open Solution Alliance

AddingFieldWebServiceExample

Code snippet

Name: Adding Field to a Web service
Version: Openbravo 2.35
Author: Victor Gaspar



Rating :
5.00/5
(1 votes cast)
You have to be registered to be able to vote

1. Make sure database has the column for the field you want to add.

2. 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.)

3. 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.

4. Modify the class to have proper variable and get/set functions for the field in question.

5. Modify ExternalSalesImpl to handle the data within method.

6. stop Tomcat, compile, start Tomcat and install web service, in this order


Example:

Goal: to add SKU field in getProductsCatalog method within Product array.

1. Database has SKU already stored in M_PRODUCT.SKU

2. Field wasn't made active in default installation, so I added it to Product Tab through System administration.

3. 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,

4. 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 [1]

Retrieved from "http://wiki.openbravo.com/wiki/AddingFieldWebServiceExample"

This page has been accessed 689 times. This page was last modified 02:15, 18 April 2008. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.


Category: Code Snippets