View source | Discuss this page | Page history | Printable version   

ERP 2.50:Developers Guide/Code Snippets/SOAP WebService

ERP 2.50:Developers Guide

Index


Warning.png   This document is still a work in progress. It may contain inaccuracies or errors.

Adding Field to a Web service

  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.



ERP 2.50:Developers Guide/Code Snippets | ERP 2.50:Developers Guide/Code Snippets/Report

Retrieved from "http://wiki.openbravo.com/wiki/ERP_2.50:Developers_Guide/Code_Snippets/SOAP_WebService"

This page has been accessed 5,854 times. This page was last modified on 14 June 2011, at 11:03. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.