Hi Experts,

I am getting "Cannot serialize object of class 
org.ofbiz.manufacturing.bom.BOMTree" error when calling getBOMTree SOAP 
services using axis2 in my eclipse.

If anyone knows how to resolve this please let me know.
below is the code which i tried.
__________________________________________________________
private static OMFactory fac;
   private static OMNamespace omNs;
 
   static {
      fac = OMAbstractFactory.getOMFactory();
      omNs = fac.createOMNamespace("http://ofbiz.apache.org/service/";, "ns1");
   }
 
   public static void main(String[] args) throws AxisFault {
 
      ServiceClient sc = new ServiceClient();
      Options opts = new Options();
      opts.setTo(new EndpointReference(
         "http://ds-sgh632ryd5:8081/webtools/control/SOAPService";));
      opts.setAction("getBOMTree");
      sc.setOptions(opts);
      //Serializable obj = (Serializable) sc.sendReceive(createPayLoad());
      OMElement res = sc.sendReceive(createPayLoad());
     
      System.out.println(res);
   }
 
   private static OMElement createPayLoad() {
 
      OMElement findPartiesById = fac.createOMElement("getBOMTree", omNs);
      OMElement mapMap = fac.createOMElement("map-Map", omNs);
 
      findPartiesById.addChild(mapMap);
      mapMap.addChild(createMapEntry("bomType", "MANUF_COMPONENT"));
      mapMap.addChild(createMapEntry("productId", "10010"));
      mapMap.addChild(createMapEntry("login.username", "admin"));
      mapMap.addChild(createMapEntry("login.password", "ofbiz"));
 
      return findPartiesById;
   }
 
   private static OMElement createMapEntry(String key, String val) {
 
      OMElement mapEntry = fac.createOMElement("map-Entry", omNs);
 
      // create the key
      OMElement mapKey = fac.createOMElement("map-Key", omNs);
      OMElement keyElement = fac.createOMElement("std-String", omNs);
      OMAttribute keyAttribute = fac.createOMAttribute("value", null, key);
 
      mapKey.addChild(keyElement);
      keyElement.addAttribute(keyAttribute);
 
      // create the value
      OMElement mapValue = fac.createOMElement("map-Value", omNs);
      OMElement valElement = fac.createOMElement("std-String", omNs);
      OMAttribute valAttribute = fac.createOMAttribute("value", null, val);
 
      mapValue.addChild(valElement);
      valElement.addAttribute(valAttribute);
 
      // attach to map-Entry
      mapEntry.addChild(mapKey);
      mapEntry.addChild(mapValue);
 
      return mapEntry;
   }

________________________________________________________________


Any help is appreciated.

Thanks,
Hatim 

Reply via email to